Link to home
Start Free TrialLog in
Avatar of IT Guy
IT GuyFlag for United States of America

asked on

How can I determine what the host server is for a Hyper V guest server operating system?

How can I determine what the host server is for a Hyper V guest server operating system?

I have connected using remote desktop to the Hyper V guest operating system, which is Server 2008 R2.

I need to get the server name of the server that hosts this Hyper V guest operating system.

Is there a way that I can look this information up from within the Hyper V guest operating system or by looking in Active Directory Users and Computers?
Avatar of IT Guy
IT Guy
Flag of United States of America image

ASKER

I have looked at this URL:
http://social.technet.microsoft.com/wiki/contents/articles/hyper-v-how-to-find-the-host-of-a-vm.aspx

For the power shell script that it mentions, what file extension should this script be saved with?

Function Get-VMHost
 
{
 
    Param([string]$ComputerName=$env:COMPUTERNAME)
 
    $HKLM = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey("LocalMachine", $ComputerName);
 
    $key = $HKLM.OpenSubKey("SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters");
 
    if ($key -eq $null)
 
    {
 
        return $null;
 
    }
 
    else
 
    {
 
        return $key.GetValue("HostName");
 
    }
 
}
ASKER CERTIFIED SOLUTION
Avatar of TomasP
TomasP
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial