Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

There's a Microsoft Virtual PC instance on my network that runs build scripts and reports problems by sending me an e-mail. I don't what machine it's running on! I can access the machine by Remote Desktop, but I don't know how to work out the host from that. What I'd really like, in the future, is to include the host name in the automated e-mail. So I have two questions:

1) If you're logged onto a virtual PC, is there any way of finding out the identity of the host machine?

2) If the answer to question 1 is yes, what's the easiest way to find the host automatically from a Python script?

share|improve this question
add comment

3 Answers 3

up vote 4 down vote accepted

Unless I am mistaken, outside of server-provided virtualization tools (like VMware's 'vmware tools'), you won't be able to determine even that the VM is a virtual machine.

Perhaps running through Hyper-V's admin consoles you could determine which machine it is running on. Outside of that, I know of no such way to determine what you're looking for.

share|improve this answer
    
You can usually tell from the outside. If you scan it, it won't look quite like a regular system. (If nothing else, if you use nmap on it, the MAC address will almost always resolve to "VMware" or something similar. –  Satanicpuppy Dec 24 '09 at 14:48
2  
You can also usually tell via CPU features or DMI information when you are on the virtual machine. –  James Dec 24 '09 at 14:54
    
Thought that might be the answer. Hey ho. Thanks. –  Tommy Herbert Dec 24 '09 at 15:01
    
if you back-lookup the MAC address, yes it can come back. But if it's been masked (seen that a lot, personally) - it won't. On Virtuozzo (what my VPS uses), the CPUs are passed-through, and the MAC address looks 'normal'. –  warren Dec 25 '09 at 13:54
add comment

Hah. Came in here to tell you I'd struck out, unless you were (for some reason) using Microsoft VM instead of VMWare.

Microsoft puts the name of the physical host in the registry of the virtual machine under:

HKLM\Software\Microsoft\Virtual Machine\Guest\Parameters\PhysicalHostName

Hope that helps.

share|improve this answer
1  
Only if you have "Virtual PC Additions" installed in the guest. –  grawity Dec 24 '09 at 15:19
    
Thanks puppy, I'll give that a try. –  Tommy Herbert Dec 26 '09 at 17:54
add comment

Worst case scenario: Locate it based on it's network connection, just as you would for a rogue machine. I start by determining which switch port it's connected to and then look up where that cable terminates.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.