Get Hostname from the Host in a Windows Guest Machine?

Discussions related to using VirtualBox on Windows hosts.
Post Reply
Volkan
Posts: 2
Joined: 16. Jan 2015, 17:57

Get Hostname from the Host in a Windows Guest Machine?

Post by Volkan »

Hi

I'm searching a way to get the hostname from the host in a windows guest machine?

Is there a way to Archive this?
Is there any enviroment vairables or something else to do that?

Thank you for any help ;)
Volkan
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: Get Hostname from the Host in a Windows Guest Machine?

Post by scottgus1 »

by "hostname", are you speaking of the name the computer goes by on the network? Such as, to access the shared folders on a Windows PC you'd type \\computername?

I don't think I have ever heard of anything built into Virtualbox that can do this, from guest to host. If you think of your problem as, how would I do this if I had two physical PCs networked to each other? Then apply the solution to your host and guest, and you're up and running.
Volkan
Posts: 2
Joined: 16. Jan 2015, 17:57

Re: Get Hostname from the Host in a Windows Guest Machine?

Post by Volkan »

Yes, i mean the host with Windows where virtualbox ist installed. The vm where is running in it should get the hostname of ist, i hope ist clear now :wink:

In VMWare Workstation i can make a Change in the configuration file and after that i can read this line from the virtual guest, is it possible to write some Information in the vm vbox fine and i read it from inside the vm?


Thx
Volkan
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: Get Hostname from the Host in a Windows Guest Machine?

Post by scottgus1 »

There is the "Vboxmanage guestproperty set/get" commands which can pass text between host and guest, if the Guest Additions are installed. You'd have to write a script to set a custom guestproperty with the name of the host, then write another script in the guest to read that custom guestproperty to find the host's name within the guest.

Or, if you can't have Guest Additions, you could use normal Windows Shared Folders and save the host name in a text file in a shared folder, and read that text file from a script in the guest.
Post Reply