VMware Cloud Community
ericfletcher
Contributor
Contributor

Invoke-VMScript returning an error I dont understand

Hi All,

I am trying to run a script against my vSphere guest machines. I am getting the following error on Windows 10 machines. It works against most of the windows 8 machines.

The 'propSet' paramter should not be null. Here is thefullerror message

Invoke-VMScript : 11/23/2021 8:34:42 PM Invoke-VMScript The 'propSet' paramter should not be null. At line:1 char:1 + Invoke-VMScript -vm 00005_Windows_10 -ScriptText {systeminfo.exe | Se ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Invoke-VMScript], ViError + FullyQualifiedErrorId : Client20_VmGuestServiceImpl_DownloadFileFromGuest_DownloadError,VMware.VimAutomation.ViCore.Cmdlets.Commands.InvokeVmScript

Reply
0 Kudos
12 Replies
fabio1975
Commander
Commander

CIao 

can you post the entire invoke-vmscript command that you run?

Fabio

Visit vmvirtual.blog
If you're satisfied give me a kudos

Reply
0 Kudos
LucD
Leadership
Leadership

We saw this issue before, most of the time it indicates a mixed up installation of PowerCLI.
See for example PowerCLI Guest OS Cmdlets Error - The 'propSet' pa... - VMware Technology Network VMTN

Start by doing 

Get-M0dule -Name VMware* -ListAvailable


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
ericfletcher
Contributor
Contributor

Thank you for responding. Here is the full script.

$file = Import-Csv user_pass.csv
# $Box,$Username,$Password = Import-Csv user_pass.csv
foreach ($line in $file){
    $box = $line.Box 
    $username = $line.Username
    $Password = $line.Password

    $vm = Get-VM $box | Select-Object -Property GuestId
    #Check for Debian Linux  machine
    if ($vm.GuestId -contains "ubuntu64Guest" -or $vm.GuestId -contains "debian8_64Guest"){

        try {
            Start-VM -VM $box  -ErrorAction Stop
            Start-Sleep -Seconds 30
        }
        catch {
            Write-Warning "$box already started!"
        }

        try{
            Invoke-VMScript -vm $box -ErrorAction Stop -ScriptText {lsb-release -a} -GuestUser $username -GuestPassword $Password -ScriptType   Bash | out-file $box 
            
        }
        catch {
            Write-Warning "Problem detecting OS  version on $box with lsb-release -a"
        }
        try{
            Invoke-VMScript -vm $box -ErrorAction Stop -ScriptText {uname -a} -GuestUser $username -GuestPassword $Password -ScriptType   Bash | out-file $box 
            
        }
        catch {
            Write-Warning "Problem detecting OS  version on $box uname -a"
        }
        try{
            Invoke-VMScript -vm $box -ErrorAction Stop -ScriptText {apt list --installed} -GuestUser $username -GuestPassword $password -ScriptType Bash | Out-File -Append $box
        }
        catch {
            Write-Warning "Problem listing installed apps on $box!!!"
        }
    }
    else {
        try {
            Start-VM -VM $box  -ErrorAction Stop
            Start-Sleep -Seconds 30
        }
        catch {
            Write-Warning "$box already started!"
        }
        
        try{
            Invoke-VMScript -vm $box -ErrorAction Stop -ScriptText {systeminfo.exe | Select-String -pattern 'Os Name','Os Version'} -GuestUser $username -GuestPassword $password | out-file $box
        }
        catch {
            Write-Warning "Problem listing installed apps on $box!!!"
        }
        try{
            Invoke-VMScript -vm $box -ErrorAction Stop   -ScriptText {wmic product}  -GuestUser $username -GuestPassword $password | out-file -Append \$box
        }
        catch {
            Write-Warning "Problem listing installed apps on $box!!!"
        }
        
    }    
    
    Stop-VM -VM $box -Confirm:$false




   

} 
Reply
0 Kudos
ericfletcher
Contributor
Contributor

Thank you for responding. I attached the results of the command. I also uninstalled PowerCLI and then reinstalled. I originally installed following the direction here: https://developer.vmware.com/powercli/installation-guide

Reply
0 Kudos
ericfletcher
Contributor
Contributor

I also ran your Test-InvokeVMScript script and here are the results from a box that my script ran successfully on.

PS C:\> Test-InvokeVMScript -VM 00255_Windows_10_B -Detail
“SilentlyContinue” : The term '“SilentlyContinue”' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of
the name, or if a path was included, verify that the path is correct and try again.
At C:\Tools\PSscripts\PSscripts\BSSN\Test-Invoke-VMScript.ps1:54 char:26
+ $ErrorActionPreference = “SilentlyContinue”
+                          ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (“SilentlyContinue”:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Exception calling "Connect" with "2" argument(s): "Value cannot be null.
Parameter name: addresses"
At C:\Tools\PSscripts\PSscripts\BSSN\Test-Invoke-VMScript.ps1:56 char:1
+ $socket.Connect($VM.Host.Name,902)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentNullException

Exception calling "GetVersionInfo" with "1" argument(s): "C:\Program Files\VMware\VMware VIX\VixCOM.dll"
At C:\Tools\PSscripts\PSscripts\BSSN\Test-Invoke-VMScript.ps1:102 char:1
+ $propertiesVix =[System.Diagnostics.FileVersionInfo]::GetVersionInfo( ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FileNotFoundException



OK                          : False
VM                          : 00255_Windows_10_B
PoweredOn                   : False
X86Engine                   : False
ToolsInstalled              : False
Port902Open                 : False
FolderReadAccess            : True
PrivilegeConsoleInteraction : True
SupportedOS                 : False



PS C:\> Test-InvokeVMScript -VM 00255_Windows_10_B -Detail

 

 

Reply
0 Kudos
LucD
Leadership
Leadership

The versions of the PowerCLI modules seem to be ok, so no issue there.

In the error message you got on Test-InvokeVMScript the text 

“SilentlyContinue”

seems to indicate something went wrong while copying the snippet.

Also, in your script the line 

Out-File -Append $box

seems strange, since you are using that variable $box for the name of the VM as well.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
ericfletcher
Contributor
Contributor

Thank you. What is a 'propset' parameter?
In addition, I purchased your book "VMware vSphere PowerCLI Reference" hoping it would answer this question. It is a grat resource; however, I did  not find a reference to 'propset'

I removed the weird characters from the Test-InvokeVM script.

Reply
0 Kudos
LucD
Leadership
Leadership

I suspect that this 'propSet' name is an internal name used in the code of some PowerCLI cmdlets.
Normally you shouldn't see that name appear in an error message.

And yes, the PowerCLI Reference does not handle that specific error.
The book would be at least twice as thick if had to mention all possible errors (if we even could do that).

A suggestion, to eliminate any issues on the station where you are encountering this error, does this code produce the same error on another station?
And do you get the same error with PowerShell v5.1 and PowerShell v7?
You can install PSv7 side-by-side on a Windows box.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
ericfletcher
Contributor
Contributor

I installed  Powershell 7 and I am getting much better results. I am getting blank ScriptOut from windows 7, XP, and Some of my Windows 8.

Reply
0 Kudos
LucD
Leadership
Leadership

Did you fix that Out-File $box ?
That is definitely an error in your code.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
ericfletcher
Contributor
Contributor

Out-File $box writes the results to a file and that works as it is.

Reply
0 Kudos
LucD
Leadership
Leadership

No, it doesn't.
You're using that same variable with Get-VM

Start-VM -VM $box  -ErrorAction Stop

Or it is a VM name or it is a file, but not both


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos