Issue:

When you are working on the VM remotely, Sometimes, you need to know on which Hyper-V server your VM currently hosted. It could be wasting a time if you have too many Hyper-V server or Hyper-V Cluster.

In this article, I will show you how to find the Hyper-V server name from the inside of the VM guest.

Resolution:

Basically, the information of the Hyper-V hostname is stored on the Windows Registry on the following path:

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

We will use Get-Item CmdLet to get the information faster. Below is the complete command to get the information.

Get-Item "HKLM:\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters"
Get-Item Hyper-V Host
Get-Item Hyper-V Host

As you can see in the image above, there are some values on the registry. Now we need to get only the HostName Value. Below the command to do that.

(get-item "HKLM:\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters").GetValue("HostName")
get-item Hyper-V Host property
Get-Item Value

If you like this article, please share, subscribe or you can follow our Facebook Page and Twitter.