Hi All,
I am looking for a script which can Power-Off and Power-On All VMs based on folder level. Please help
Get-VM | where {$_.status -eq "powered on"} | Poweroff-VM
Thanks
Madhu
You mean like this
Get-VM -Location (Get-Folder -Name MyFolder) | where {$_.status -eq "powered on"} | Poweroff-VM
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks a lot LuCD as always, you are the best
I had make little changes and below one worked.
Get-VM -Location (Get-Folder -Name MyFolder) | where {$_.PowerState -eq "PoweredOn"} | Shutdown-VMGuest