There are several ways you can determine the virtualization host (server with the Hyper-V role enabled), also called the physical host, that a VM is running on.

If the host OS is Windows Server 2008 R2, and the virtual machines on it are using the R2 integrations services, then you can query the following:

$[HKLM\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters]

Using SCVMM:

Get-VMMServer | Get-VM Server1 | Select-Object vmhost

Replace to the FQDN of your VMM cluster and Server1 to the server you're looking for.

Using PowerShell:

This script pulls the host name from the VM's registry.

Function Get-VMHost
    (get-item "HKLM:\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters").GetValue("HostName")

Using WMI and PowerShell

function Get-VMOSDetail
        $ComputerName = $Env:ComputerName,
    # Creating HASH Table for object creation
    $MyObj = @{}
    # Getting VM Object
    $Vm = Get-WmiObject -Namespace root\virtualization -Query "Select * From Msvm_ComputerSystem Where ElementName='$VMName'" -ComputerName $ComputerName
    # Getting VM Details
    $Kvp = Get-WmiObject -Namespace root\virtualization -Query "Associators of {$Vm} Where AssocClass=Msvm_SystemDevice ResultClass=Msvm_KvpExchangeComponent" -ComputerName $ComputerName
    # Converting XML to Object
    foreach($CimXml in $Kvp.GuestIntrinsicExchangeItems)
        $XML = [XML]$CimXml
            foreach ($CimProperty in $XML.SelectNodes("/INSTANCE/PROPERTY"))
                switch -exact ($CimProperty.Name)
                    "Data"      { $Value = $CimProperty.VALUE }
                    "Name"      { $Name  = $CimProperty.VALUE }
    # Outputting Object
    New-Object -TypeName PSCustomObject -Property $MyObj

Using System Center Configuration Manager:

This T-SQL query can be used to generate a report giving the number of hosts per guest:

SELECT [PhysicalHostNameFullyQualifi0] AS [Host FQDN], COUNT(PhysicalHostNameFullyQualifi0) AS [Count of Guests]
  GROUP BY [PhysicalHostNameFullyQualifi0]
This T-SQL query can used to generate a report matching hosts to guests 

SELECT sys.Netbios_Name0, vm.PhysicalHostName0, vm.ResourceID
JOIN v_R_System AS sys ON vm.ResourceID = sys.ResourceID

Using MMC:


See Also