Problem solve Get help with specific problems with your technologies, process and projects.

How can you track a VM to its physical host computer?

Virtualization offers many advantages by abstracting workloads from hardware, but you may still need to find where a VM's files are physically located.

How can I track a virtual machine to its underlying host computer?

One principal benefit of virtualization is abstraction -- breaking the dependence of a workload from its underlying hardware. This abstraction allows critical capabilities, including workload migration and rapid, non-disruptive snapshots. But even though virtualization makes the actual physical location of a workload irrelevant, IT professionals might need to identify where a VM is running in order to perform practical tasks, such as workload balancing, when storing VM images, when system maintenance demands VMs move to other servers, or when new servers come online and workloads must be migrated from older hardware. These tasks all require tools and techniques to identify VMs in the physical environment and make strategic choices about workload location, configuration and protection.

There are numerous ways to identify the host computer for a particular VM. The most immediate and direct way is to use a systems management tool such as Microsoft's System Center, VMware's vCenter Server or another third-party tool. As an example, System Center Virtual Machine Manager, or SCVMM, users can make a query such as:

Get-VMMServer myVMcluster.domain.com | Get-VM Serverofinterest | Select-Object vmhost

In this type of query, you'd replace myVMcluster.domain.com with the fully qualified domain name of the VM cluster, and also replace Serverofinterest with the name of the server that you're looking for.

Databases can also be queried to report details such as the VM ID, VM name, host ID, host name and other bits of information. For example, System Center Configuration Manager, or SCCM, users can create Transact-SQL queries, while VMware users can query the vCenter Server database in Microsoft SQL. Database queries typically require logging into the database, opening the database management panel, opening the database used by the virtualization management tool, opening a query window and then running a database query using a series of commands. The actual query syntax and complexity can vary dramatically, so it's always best to check the virtualization management tool documentation for additional guidance and specific examples.

Another tactic might be to review the current logs for the specific VM. As an example, VMware users can connect to a host with access to VM data stores, locate the working directory for the VM of interest, and then check the vmware.log file to locate a Hostname entry such as:

<entry date and time stamp> | Hostname=name_of_host

And finally, Windows shops can always turn to PowerShell and create a variety of scripts to access the desired information. As one simple example, one command line with commands like Get-item and GetValue can extract the host computer name from a VM's registry such as:

Function Get-VMHost
  (Get-item "ABCD:\Software\MS\VMachine\Guest\Details").GetValue("HostName")

It's important to remember that these are only simple examples, so always refer to documentation and experienced scripters for guidance and details about actual coding practices.

This was last published in October 2014

Dig Deeper on Introduction to virtualization and how-tos



Find more PRO+ content and other member only offers, here.

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Join the conversation


Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

Hi There, Thanks for the article. Consider a scenario, you are not clue about the VM -- you can RDP to it and from msinfo32 you find out this is a VM. How will then go about fiding the host name from the OS and no other info is available. Thanks
Can a party from external network (via the web) be able to track a VM to its physical host computer if both machines are connected to the web at the same time (but both connected to the internet via proxy with different IP locations)?
We use AWS and the AWS console allows us to see where specifically our machines are located. Granted, there are limitations as to exactly how much we can do or pinpoint to exact hardware, but for most cases, the level of control provided lets us do most of the steps we need. If we need more, our Ops team gets in touch with AWS directly and we take it from there.