VMware Cloud Community
Pavlik972
Contributor
Contributor

Invoke-VMScript strange behavior

I noticed different output of Invoke-VMScript executed on the same VM from different PowerCLI versions. Ok, it's my deduction that it depends from the PowerCLI version, because I can't think of anything else.

I saw the "problem" with a 'netstat -plano | grep 700' where on the first PC the output was correct, while on the second one, the line was incomplete, that means that the grep found the correct line to be showed but the output was bad formatted and I can't see the TCP port 700x but only the second part of the line:

PS C:\> Invoke-VMScript -ScriptText "netstat -plano | grep 700" -VM $test -GuestCredential $Linux

ScriptOutput
-----------------------------------------------------------------------------------------------------------------------------
0.0.0.0:* LISTEN 3377/java off (0.00/0/0)
| tcp 0 0 10.100.x.xx:7002 0.0.0.0:* LISTEN 3377/java off (0.00/0/0)
| tcp 0 0 10.100.x.xx:7001 10.100.x.xx:34697 ESTABLISHED 3377/java off (0.00/0/0)

The first line ( the bold one ) is missing some information !!

After some other tests I can summarize with these 2 examples:

EXAMPLE 1:

PS C:\> Invoke-VMScript -ScriptText "echo 'ONE' ; echo 'TWO' ; echo 'THREE'" -VM $test -GuestCredential $Linux
AVVISO: The version of VMware Tools on VM 'ay02ap1x' is out of date and may cause Invoke-VMScript to work improperly.

ScriptOutput
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| ONE
| TWO
| THREE
|
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


PS C:\> Get-PowerCLIVersion

PowerCLI Version
----------------
VMware PowerCLI 11.2.0 build 12483598

EXAMPLE 2:

PS C:\> Invoke-VMScript -ScriptText "echo 'ONE' ; echo 'TWO' ; echo 'THREE'" -VM $test -GuestCredential $Linux

ScriptOutput
--------------------------------------------------------------------------------------------------------------
| TWO
| THREE
|
--------------------------------------------------------------------------------------------------------------


PS C:\> Get-PowerCLIVersion

PowerCLI Version
----------------
VMware PowerCLI 12.1.0 build 17009493

 

Any idea if this is a bug of the 12.1 version of the PowerCLI ?

I thougth it was because VMware tools was old, but I have the same result also after the VMware tools update.

Aby advice appreciated.

Thanks in advance

Pavlik

0 Kudos
0 Replies