Hello,
I'm getting an error with the command Stop-VM.
This is the script i'm trying to run :
&{foreach($vm in Get-Folder "Sandbox" | Get-VM)
{
if ($vm.PowerState -eq "poweredOn"){
$vm | Stop-VM -Kill -Confirm:$false
}
}
}
and here is the error i'm getting :

I get the same error with
&{foreach($vm in Get-Folder "Sandbox" | Get-VM)
{
if ($vm.PowerState -eq "poweredOn"){
Stop-VM -VM $vm.Name -Kill -Confirm:$false
}
}
}
For info I'm running this script from a VM (Ubuntu 16.04) and I'm using VMware.PowerCLI 10.0.0.7895300, Powershell v6.0.2 and a vCenter 5.5.
Thanks