Hi,
I am getting the below error when used the Invoke-VMScriptPlus v3 function
$vmName = 'mypup1.abc.loc'
$credVM = Get-VICredentialStoreItem -Host $vmName
$cred = New-Object System.Management.Automation.PSCredential ($credVM.User, (ConvertTo-SecureString $credVM.Password -AsPlainText -Force))
$sInvoke = @{
VM = $vmName
GuestCredential = $cred
ScriptText = 'sudo ls -l /opt'
ScriptType = 'bash'
Sudo = $true
}
Invoke-VMScriptPlus @sInvoke
error :
Invoke-VMScriptPlus : Cannot process argument transformation on parameter 'VM'. Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
At D:\Downloads\Invoke-VMScriptPlus.ps1:621 char:21
+ Invoke-VMScriptPlus @sInvoke
+ ~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Invoke-VMScriptPlus], ParameterBindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,Invoke-VMScriptPlus