shell Control Hyper-V Guests with PowerShell

$query = "SELECT * FROM Msvm_ComputerSystem WHERE ElementName='Hoth'"
$VM = get-wmiobject -query $query -namespace "root\virtualization" -computername "."
$Result = $VM.RequestStateChange(2)//start
$Result = $VM.RequestStateChange(3)//stop
$Result = $vm.requeststatechange(32769)//save
Use the above to start/stop/save a VM (named Hoth in this instance).

Updated: Friday 15th July 2011, 06:36pm

There are 0 comments

Leave a comment of your own

Comments are currently closed.