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

"HostName"="Hypervman0"
"HostingSystemEditionId"=dword:00000007
"HostingSystemOsMajor"=dword:00000006
"HostingSystemOsMinor"=dword:00000003
"HostingSystemProcessorArchitecture"=dword:00000009
"HostingSystemSpMajor"=dword:00000000
"HostingSystemSpMinor"=dword:00000000
"PhysicalHostName"="HYPERVMAN0"
"PhysicalHostNameFullyQualified"="Hypervman0.domain.co.za"
"VirtualMachineId"="CA0BDECF-2DDB-4388-A6B8-BACED5283354"
"VirtualMachineName"="VMname"

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

No comments:

Post a Comment