Get Hyper-V host name from guest VM

The Problem
I have a server that I know is a VM but I do not know what Hyper-V host it is on.

The Solution
Open an elevated PowerShell prompts on the guest VM and enter the following:

(get-item “HKLM:\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters”).GetValue(“HostName”)

The Hyper-V host name will be returned

NB: please be careful when pasting lines that have quotation marks into PowerShell. I’ve found the format of the quotation mark is not recognised and causes the command to fail. If in doubt, manually replace the quotation marks.

Disclaimer: provided “AS IS” with no warranties and confer no rights


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s