How to start VMs on Hyper-V Server 2008 R2 (Core) when DCs are not available
We are relocating our office and a Hyper-V Server 2008 was shutdown for the move. At the new location, after connecting the cables and powering it up, I realise I can no longer access the VM on it at a fixed static IP.
I connected a monitor, keyboard and mouse directly to the server and logged in only to find 2 command prompt, one black and one blue background, with the latter running sconfig.cmd with a bunch of options like setting network settings, computer name, add local administrator, log off, shutdown etc.
How can I view the list of VMs configured on the server and see their status and boot them up?
After much research, and trial and errors, here is my situation:
The DC responsible for the Hyper-V server is located in another country and I do not have VPN access to the DC's site. Using Hyper-V Manager, I get RPC service error most probably due to password expiry and I have no way to refresh the password on Hyper-V.
I need a way to start VM on the command prompt itself. Thanks.
Solution 1:
There are lots of libraries and GUI tools to manage Hyper-V as suggested by TomTom and also includes the MMC Hyper-V Manager Microsoft provides. However, all these tools assumes a particular set up before they can actually connect and be useful.
If you are really messed up and have only the server core installation, in a different domain, with a expired cached administrator username/password, no access to DCs, and no idea what the VM name is, the powershell commands will come in handy (it's probably the only way to start the VM given this scenario).
#The name of the virtual machine to be started
$VMName = "Windows Server 2003"
#Get the VM Object
$query = "SELECT * FROM Msvm_ComputerSystem WHERE ElementName='" + $VMName + "'"
$VM = get-wmiobject -query $query -namespace "root\virtualization" -computername "."
#Request a state change on the VM
$Result = $VM.RequestStateChange(2)
By the way, to start powershell on Server Core installation where you are greeted by the blue (sconfig.cmd) and black commad prompt windows, type "powershell" in the black command line prompt.
Solution 2:
Powershell. Various additional tools. Or just use sconfig to reestablish networkng (change ip setup) and then use a server / workstation to manage it, like before.
http://pshyperv.codeplex.com/
is a powershell library to manage Hyper-V.
http://www.manageengine.com/free-hyper-v-configuration/free-hyper-v-configuration-index.html
is a UI for Hyper-V.