cls get-help get-alias get-command Get-Service get-service wmi* get-help get-service -example Enable-psremoting Enter-pssession host-boston -credential host-boston\administrator Exit-pssession #{when done} disable-psremoting Get-WmiObject -namespace root\virtualization -class Msvm_ComputerSystem | Get-Member $VMs = get-wmiobject -computername localhost -Namespace root\Virtualization -query "Select * from MSVM_Computersystem" write-host "" write-host "Name Description State" write-host "--------------------------------------- ---------------------------------- -------------" foreach ($VM in $VMs) { $name = $VM.Elementname.PadRight(39," ") $desc = $VM.Description.PadRight(34," ") $state_num = $VM.EnabledState switch ($state_num) { 2 {$State_text = "Running"} 3 {$State_text = "PowerOff"} 4 {$State_text = "ShuttingDown"} 10 {$State_text = "Reset"} 32768 {$State_text = "Paused"} 32770 {$State_text = "Starting"} 32771 {$State_text = "SnapshotInProgress"} 32772 {$State_text = "Migrating"} 32773 {$State_text = "Saving"} 32774 {$State_text = "Stopping"} 32776 {$State_text = "Pausing"} 32777 {$State_text = "Resuming"} 32769 {$State_text = "Saved"} default {$State_text = "Unclassified (so far)"} } write-host "$name $desc $State_text ($State_num)" }write-host "" Setup variables for the VM we are looking for, and the new name #$VMName = "Server Core 2008 R2 SP1"  #$NewVMName = "ServerCore"  $VMName = "ServerCore“ $NewVMName = "Server Core 2008 R2 SP1"  #Get a VMManagementService object $VMManagementService = gwmi –class "Msvm_VirtualSystemManagementService" -namespace "root\virtualization" -computername "."  #Get the VM object that we want to modify $query = "SELECT * FROM Msvm_ComputerSystem WHERE ElementName='" + $VMName + "'“ $VM = gwmi -query $query -namespace "root\virtualization" -computername "."  #Get the VirtualSystemSettingsData of the VM we want to modify $query = "Associators of {$VM} WHERE AssocClass=MSVM_SettingsDefineState“ $VMSystemSettingData = gwmi -query $query -namespace "root\virtualization" -computername "."  #Change the ElementName property $VMSystemSettingData.ElementName = $NewVMName  #Update the VM with ModifyVirtualSystem $Result = $VMManagementService.ModifyVirtualSystem( $VM.__PATH,$VMSystemSettingData.psbase.GetText(1)) Add-WindowsFeature Hyper-V