Script to Turn Off all Hyper-V VMs?
-
Thursday, October 30, 2008 7:02 PMNeed a script to Turn Off all the VMs running on a server with the Hyper-V role enabled?
Tony Soper
All Replies
-
Thursday, October 30, 2008 7:04 PM
John Kelbley provides one, you can leave feedback here or contact johnkel@microsoft.com:
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\virtualization")
Set vmcollecion = objWMIService.ExecQuery("SELECT * FROM Msvm_ComputerSystem",,48)' loop through all instances in collection
For each vm in vmcollecion
RequestReturn = vm.RequestStateChange(3)
Next
Tony Soper -
Monday, November 24, 2008 1:26 PMYou can also check my blog on Hyper-V and PowerShell.
I have some examples using PowerShell coding against WMI
EnjoY!
/Dung
http://dungkhoang.spaces.live.com

