On my Windows 10 Pro Hyper-V, I have a Server 2019 VM whose hostname is the default WIN-MUMBOJUMBO. On searching the Intertubes for a possible solution to find this hostname ‘scriptually’, I came across this solution, which unfortunately no longer works:
(Get-Item “HKLM:\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters”).GetValue(“Hostname”)
When I run the above line, I get a different value for ‘Hostname’ than the WIN-MUMB…
So, is there another way to determine PowerShell scriptually the hostname of the VM(s). I need this so that I can then run Configurations on the different VMs I intend to create on Hyper-V.
Any help is appreciated.