Retrieve a Guest machine Hosts' Computer Name within Guest

Discussions about using Windows guests in VirtualBox.
Post Reply
bureau13
Posts: 2
Joined: 9. Jul 2011, 16:34
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: MS Windows 7

Retrieve a Guest machine Hosts' Computer Name within Guest

Post by bureau13 »

Using a Windows 7 Host and a Windows 7 Guest, is there anyway within the Guest to find out the Host's computer name (preferable) or the IP address, from the command line, or via some API call, or some other way that could be done from say within a batch file (or .net app maybe).

One reason (though not the only one) is that sometimes I need to connect through RDP via the host machine, rather than direct, but if I move the guest machine around between host machines I don't know which host machine to connect to. I send a message when a guest machine starts up so that I know it's online, the IP address, etc but want to include the host machine so that I can then also use this to connect to if for some reason I can't connect direct.

Does any of that make sense? Am I missing something obvious?

Help me, Obi-Wan Kenobi*. You're my only hope.

Thanks in advance.

*Insert your own name
pdufrene
Posts: 5
Joined: 11. Nov 2010, 17:57
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: windows

Re: Retrieve a Guest machine Hosts' Computer Name within Guest

Post by pdufrene »

Hello

Did you tried "VBoxControl guestproperty enumerate" from command line it will give you all Guest properties.
Maybe one of them can help you.

If not, you can still from the host command line call VBoxManage to set any guest property, so you can create one with the Host machine name and then read it from the Guest
bureau13
Posts: 2
Joined: 9. Jul 2011, 16:34
Primary OS: MS Windows 7
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: MS Windows 7

Re: Retrieve a Guest machine Hosts' Computer Name within Guest

Post by bureau13 »

Hi,

Thanks for the pointer. I looked but there wasn't anything there about the Host, well nothing to do with name or ip-address. I will have a play around with adding guestproperty however I would still need to update it when then image is moved around between machines, and I was hoping for a self-contained solution, i.e. within the guest machine which hopefully would work if utilising teleporting or simply cloning for testing purposes blah blah blah.

Thanks though, hopefully someone might point me in the right direction, maybe the SDK can help!
Post Reply