25 May 2015

Retrive Hyper-V host details from within the VM

Normally it is not hard to keep track of where your VMs are running.   After all there are numerous consoles and tools to use during the various stages or environments a VM can be in.

If however you find yourself with a VM that is on the network and you cannot track down the host that owns it you can get some of the host information from the VM providing the guest services are installed and running

The Registry key that maintains this information in the VM is

HKLM:\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters


You can retrieve this info from  the registry or run the following PowerShell just to return the name

(Get-ItemProperty –path "HKLM:\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters").PhysicalHostName