Find Your Hyper-V VM’s Host Name with PowerShell

Use PowerShell to find your Hyper-V host host name from inside a VM.

Michael Otey

May 14, 2015

1 Min Read
Find Your Hyper-V VM’s Host Name with PowerShell

For more technical explainers on PowerShell, read our updated 2021 report: PowerShell 101: A Technical Explainer for IT Pros.

Q: I remotely manage a number of different VMs that are running on multiple Hyper-V hosts and I don’t always know the Hyper-V host name of the VM that I’m using. Is there a way I can find the Hyper-V host name from inside the VM?

A: You can find the Hyper-V host name in the guest VM’s registry at the following key:

HKLMSOFTWAREMicrosoftVirtual MachineGuestParameters

However, repeatedly looking into the registry with regedit can be time consuming and tedious. The following PowerShell command retrieves the VM’s host name and it works on Windows Server 2008 and higher.

PS C:temp> (get-item "HKLM:SOFTWAREMicrosoftVirtual MachineGuestParameters").GetValue("HostName")


Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like