- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What would define if it should be a guest shutdown or a power off?
The presence of VMware Tools?
Something like this?
foreach($vmName in (Get-Content -Path .\vmnames.txt)){
$vm = Get-VM -Name $vmName
if($vm.Guest.State -eq "Running"){
Shutdown-VMGuest -VM $vm -Confirm:$false
}
else{
Stop-VM -VM $vm -Confirm:$false
}
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference