WIndows Hyper-V hosting Linux VMs RRS feed

  • Question

  • Hi ,

    I have two VMs (RHEL 6.5 and RHEL 7) on Windows Hyper-V(Windows Server 2012 R2). I have installed KVP daemon, and I periodically fire query to get VM’s Hostname (via Powershell script).

    There is irregularity in the output as sometimes I get VM's hostname but other times I either get some error like "getaddrinfo failed..." (which is a known bug in Linux)or the entire data for that VM is lost (both hostname and OS name is lost).

    Could anyone please help me with it ?

    if([Environment]::OSVersion.Version -ge (new-object 'Version' 6, 2,9999999,9999999)) {
            $ns = "root\virtualization\v2"
            $ns = "root\virtualization"
    Foreach ($vmid in $args)
    write-Output "----------------------------------------------------------------" 
    write-Output "VMID $vmid"
    write-Output " " 
    filter Import-CimXml
        $CimXml = [Xml]$_
        $CimObj = New-Object -TypeName System.Object
        foreach ($CimProperty in $CimXml.SelectNodes("/INSTANCE/PROPERTY"))
    if ($CimProperty.Name -eq "Name" -or $CimProperty.Name -eq "Data")
             $CimObj | Add-Member -MemberType NoteProperty -Name $CimProperty.NAME -Value $CimProperty.VALUE
    $VmObj = Get-WmiObject -Namespace $ns -Query "Select * From Msvm_ComputerSystem Where Name='$vmid'"
    $KvpObj = Get-WmiObject -Namespace $ns -Query "Associators of {$VmObj} Where AssocClass=Msvm_SystemDevice ResultClass=Msvm_KvpExchangeComponent"
    $KvpObj.GuestIntrinsicExchangeItems | Import-CimXml | Where-Object {$_.Name -eq "FullyQualifiedDomainName" -or $_.Name -eq "OSName"} |ft -AutoSize

    • Moved by BrianEhMVP Wednesday, March 18, 2015 3:27 PM
    Wednesday, March 18, 2015 8:22 AM

All replies

  • Hi,

    I also having same problem whereby the Linux computer name is getaddrinfo failed. 


    After i set the hosts name in /etc/hosts aligned with /etc/sysconfig/networks hostname, HyperV seems to able to get the computer name correctly. 

    • Edited by RalphKoh Wednesday, April 1, 2015 2:25 PM
    Wednesday, April 1, 2015 2:05 PM