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. 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.
You can find that information under the following registry key:
Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters
You will get some additional information about the Hyper-V host as well was the Physical Hyper-V Hostname of the VM.
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
Since we run a version of Hyper-V in our Microsoft Azure datacenters, this also works with Azure VMs.
I hope this post was helpful and shows you how you can find the hostname the physical Hyper-V host of a VM. if you have any questions feel free to leave a comment below.
And yes, the first screenshot was taken on a Surface Pro X running Hyper-V on Windows 10 on ARM.
Tags: Azure, Host, Hostname, Hyper-V, Hyper-V Host, Key, Microsoft, Physical, PowerShell, registry, Virtual Machine, Virtualization, Windows 10, Windows Server Last modified: January 19, 2021
How to enable internet on Hypwr V. Srarched in Google and ms docs not useful.
1. I have created vm in Azure
2. Installed Hyper v role in the vm
3. In Hyper V console I have created NEW VM
4. Here in the new VM internet not working
I have ckecked added network card, enabled EXTERNAL for internet
BBUT STILL internet not working
Can you please help me in this
Simple, just follow these steps. The issue is that you cannot just create an external switch, you will need to create a NAT switch, you can find all of that here: https://www.thomasmaurer.ch/2017/07/how-to-setup-nested-virtualization-in-microsoft-azure/
Hello Thomas,
Thanks for the info and your blog!
Any chance you can point me to a ressource for doing the opposite of your post ?
I want to guess the hostname of the VM (Linux or dos VMs) from the host’s PowerShell.
We have a lot of Hyper-V hosts and I move the VMs quite often. I’d be nice to have the VMname AND the VM hostname (fqdn ideally), any chance you have a ressuorce to point to ?
thanks for sharing ✌
how can you get the replication server name from the virtual machine?