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.

Is there a way to get a VM's name or UUID from within the VM itself, for a VM that is running on a VMWare ESX server? If so, what is the way?

My use case is: I'm cloning a bunch of VMs. A program running inside the clones connects to a server. I want to know which cloned VM that program is running on. What would be the best way to do that? I can assign it a number from the server automatically, print it out from the VM, and type it in manually, but that seems lame.

share|improve this question

1 Answer 1

When you clone the VMs are you not connecting to them to change their hostname and IPs anyway? in which case just go off the hostname. If you're not changing their hostnames and IPs then you could just do an nslookup of the DHCP-provided IP address and use that? You can get the VM name via the APIs but it's not always the best way of achieving what you want.

share|improve this answer
    
i want this to be done entirely automatically. basically, i want the server to have a list of the VMs indexed by unique number. user can then, from the server, set what hostname and ip the vm should have. then a program running on the VM will get that info from the server and set them automatically (along with doing some other things). so i'll clone say 20 vms, assign them a few things in one location, and have them set themselves up the rest of the way. it seems, to do that, i need to link the VM name to the auto-assigned number on the server –  Claudiu Aug 8 '11 at 17:30
    
when assigning the unique numbers to IPs and such, it doesn't matter what the hostname is.. but i might have to change some VM settings (like the internal network of the VM) based on those, so for that i need to identify the VM itself.. otherwise i could just do it all from the program that gets the number anyway –  Claudiu Aug 8 '11 at 17:31

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.