Q
Evaluate Weigh the pros and cons of technologies, products and projects you are considering.

How do I find a VM host computer in a Microsoft or VMware environment?

Virtualization offers many advantages by abstracting workloads from hardware, but you may still need to find the VM host computer. You can do so using these queries and commands.

How can I find a VM 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, nondisruptive snapshots. But even though virtualization makes the actual physical location of a workload irrelevant, IT professionals might need to find a VM host system in order to perform practical tasks. Tasks can include workload balancing, managing VM image or snapshot storage, preparing for system maintenance -- triggering VM migrations to other servers -- or when new host servers come online and workloads must be migrated from older hardware. These tasks all require tools and techniques to find the VM host in the physical environment and make strategic choices about workload location, configuration and protection.

There are numerous ways to find VM host computers for a particular VM. The most immediate and direct way is to use a systems management tool such as Microsoft's System Center; an admin working in a vSphere environment might use VMware's vCenter Server or another third-party tool. As an example, System Center Virtual Machine Manager users can make this query:

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 you're looking for.

Similarly, a vSphere environment could use the Get-VMHost command to find a vSphere VM host server. An example query might include the –Location parameter to narrow down data centers, folders or other criteria and the –VM parameter to denote the VM name whose host systems you want, such as:

D:\PS>Get-VMHost -Location (Get-Datacenter -Name Central) -VM (Get-VM -Name "MyExperimentalVM")

In this case, the query should find the VM host located in the Central data center that runs the "MyExperimentalVM" VM instance. Results will include the domain name system or the IP address of the ESXi host system.

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 users can create Transact-SQL queries, while VMware users can query the vCenter Server database in Microsoft SQL. Database queries typically require logging in to 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 a command-line tool like PowerShell to create a variety of PowerShell scripts that will access the desired information. As a simple example, one command line with commands like Get-item and GetValue can find the Hyper-V VM host computer name from a VM's registry key, such as:

Function Get-VMHost
{
 (Get-item "HKLM:\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. It's also good practice to test scripts -- or any executable code base -- in an isolated network before using it in a production environment. This helps to avoid accidental errors or unintended consequences that could disrupt production.

Next Steps

Get away with a stand-alone virtualization host

Differentiate between a host hypervisor and nested hypervisor

Respond to your first host crash

This was last published in April 2017

Dig Deeper on Introduction to virtualization and how-tos

PRO+

Content

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

4 comments

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.

What are some tips for locating a VM host in other types of environments?
Cancel
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
Cancel
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)?
Cancel
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.
Cancel

-ADS BY GOOGLE

SearchVMware

SearchWindowsServer

SearchCloudComputing

SearchVirtualDesktop

SearchDataCenter

Close