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?
Thursday, October 30, 2008 7:04 PMJohn Kelbley provides one, you can leave feedback here or contact firstname.lastname@example.org:
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)
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