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.
Run dmidecode and grep for UUID.
This should be the same UUID assigned to the uuid.bios of the VM.
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.