Need a ps script to shutdown all vm's on specific datastore and to exclude some of the vm's. thank you in advance.
What do you already have?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thank you for quick reply LuCD, here it is-
this is the script i have to shutdown all vms except in *, but would like to add cluster and datastore specific
Get-VM | Where-object {$_.name -notlike '*******' } | Stop-VMGuest -Confirm:$false
newbie to PowerShell , appreciate your help and thank you in advance.
You can use the Datastore parameter to limit the returned VMs to only the ones on that datastore
Get-VM -Datastore MyDS |
Where-object {$_.name -notlike '*******' } |
Stop-VMGuest -Confirm:$false
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
how about cluster filtering?
Use the Location parameter on the Get-VM cmdlet.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
can share the command so i can try on.
Which command?
It is the same command, just add the Location parameter.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
