Find the Hostname of a Hyper-V Virtual Machine (VM)

Just another Tech site

Find the Hostname of a Hyper-V Virtual Machine (VM)

If you are running a virtual machine (VM) on Hyper-V, sometimes you want to know on which Hyper-V host this VM is running.  I work on a lot of VM’s and this is cool part of knowing where to look, especially when troubleshooting.

If you don’t have access to the Hyper-V host, you need to find that information from within the virtual machines operating system.

Luckily, the hostname of the physical Hyper-V server the virtual machine is running on can be found in the virtual machines registry.

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters

 

 

 

 

 

 

 

This is the cool part, you could also run the following PowerShell command to get the Hyper-V hostname inside the VM:

Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters" | Select-Object HostName