VMware Communities
michel_hesse
Contributor
Contributor

rename the Guest similar to the Host Computername

Hi there, I am wondering if there is a way to find out the Hostname of the VMHost a VMGuest is running on.

Example, I am running a WinXP Guest on my Win 7 Host. I'd like to hav the Guest Computer to have a similar name like the Host.

For Example the Host is "MyPC" and I'd like to read the hostname inside the Guest and rename the Guest automatically with netdom.exe to "MyPC-VM".

Is there a way to do this ?

0 Kudos
6 Replies
continuum
Immortal
Immortal

sure - give the guest the computername you want - that is a windows-function - not related to VMware at all




_________________________

VMX-parameters- WS FAQ -[ MOAcd|http://sanbarrow.com/moa241.html] - VMDK-Handbook


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos
FranckRookie
Leadership
Leadership

Hi Michel,

There is no direct communication between the host and the guest. So it won't be possible for the guest to find the name of the host.

I read a few articles about defining the value of "machine.id" to the host name in the vmx file and retrieving it from inside the guest, but I never tested it.

Good luck!

Regards

Franck

0 Kudos
michel_hesse
Contributor
Contributor

is there a way to delete this anwer of continuum ?

0 Kudos
chadwickking
Expert
Expert

No, vmware doesn't delete anything. lol.

Your best bet would be too look at PowerCLI for vSphere and I would like to request this to be moved there as someone could help you out more than likely.

Cheers,

Chad King

VCP-410 | Server+

Twitter:

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful

Cheers, Chad King VCP4 Twitter: http://twitter.com/cwjking | virtualnoob.wordpress.com If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
0 Kudos
continuum
Immortal
Immortal

is there a way to delete this anwer of continuum ?

yes - sure . I could delete it - but I see no reason to do so.

Just so that you know - in most cases the quality of the answer you get here depends on the quality of the question.

If you want to delete the question let me know - no problem.




_________________________

VMX-parameters- WS FAQ -[ MOAcd|http://sanbarrow.com/moa241.html] - VMDK-Handbook


________________________________________________
Do you need support with a VMFS recovery problem ? - send a message via skype "sanbarrow"
I do not support Workstation 16 at this time ...

0 Kudos
joehecht
Enthusiast
Enthusiast

Passing a variable through the setting of the machine.id variable does work, and can be used to do a lot of interesting things, however, it takes a lot of work for seemingly little payback.

I know that with the Windows version, you can also use VmRun from a batch file to do all sort of things in a guest, like set enviroment variables, read and write files, run prorgrams and scripts, reboot, work with snapshots, and so forth.

I recently wrote a program to clone off and deploy 64 VM's, each with unique MAC addresses, IP's and the like. I wrote a one line program that makes a call to the Windows API function SetComputerName() to change the name of the machine(s) and run it via vmrun utility. Seems to work Smiley Happy

Couple vmRun with vmware-vdiskmanager, and continum's documenation of the .vmx parameters, and you can do an amazing job of auto-configurinfg guests Smiley Happy

Joe

0 Kudos