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

 Thank to: https://www.itprotoday.com/


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

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:

HKLM\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters

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:\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters").GetValue("HostName")

Comentarios

Entradas populares de este blog

Guía de herramientas básicas para estudiantes: 31 apps y webs imprescindibles para ayudarte con los estudios

Comando FOR para archivos BAT

Policy Based Routing example: route one subnet via ISP A and another via ISP B