Starting a Virtual Machine from Powershell on a 2008R2 Core server with the Hyper-V role install.

# name of the vm we want to start
$vmName = "my-vm"
 
# find the vm
$query = "SELECT * FROM Msvm_ComputerSystem WHERE ElementName='" + $VMName + "'"

# get the vm
$vm = get-wmiobject -query $query -namespace "root\virtualization" -computername "."
 
# turn the vm on 
$res = $vm.RequestStateChange(2)