Find Your Hyper-V VM’s Host Name with PowerShell
Use PowerShell to find your Hyper-V host host name from inside a VM.
May 14, 2015
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")
About the Author
You May Also Like