Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
This information sourced from Ben Armstrong's Virtual PC Guy blog at: http://blogs.msdn.com/b/virtual_pc_guy/archive/2011/01/07/what-physical-computer-am-i-on.aspx
Applies to: Hyper-V, Virtual Server and Virtual PC.
To get the name of the physical computer that you are running on, open a PowerShell console inside the virtual machine and type in:
(Get-ItemProperty –path “HKLM:\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters”).PhysicalHostName
You can also get the fully qualified name of the physical computer by running:
(Get-ItemProperty –path “HKLM:\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters”).PhysicalHostNameFullyQualified
To get the name of the virtual machine itself, open a PowerShell inside the virtual machine and type in:
(Get-ItemProperty –path “HKLM:\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters”).VirtualMachineName
To do this using VBScript, see Ben's blog post: Programmatically detecting host information from inside the guest under Virtual PC and Virtual Server.