Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 294344

shutdown-vmguest runasync

$
0
0

I cannot get the following to work with a list of vms. only one at a time

 

 

$allLines = @() # Line added
Get-VM -Name  (Get-Content -Path "C:\vms.txt") |`
ForEach-Object {
     If ($_.Powerstate -eq "poweredOff") {
echo $_ is powered off
}
Else {
     Shutdown-VMGuest $_ -Confirm:$false -RunAsync
sleep 60
Move-VM $_ -Destination xxx.xxx.com -Confirm:$false -RunAsync
sleep 5
Get-NetworkAdapter | Set-NetworkAdapter -NetworkName dvPG-vlan245 -Confirm:$false -RunAsync
     Start-VM $_ -Confirm:$false -RunAsync
}
}
any idea why I cannot run the task on all vms together?

Viewing all articles
Browse latest Browse all 294344


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>