Yes this would be another option, though as you mentioned, if you modify machine.id, other tools may not be able to read this value.
You actually don't need to specify any credentials when you using vmware-cmd locally on an ESX host.
Here is what you should be doing:
Update all your VM .vmx file with the hostname of your ESX host
[root@himalaya ~]# vmware-cmd /vmfs/volumes/4aa95d52-c297af51-90e2-003048d9586a/William-XP/William-XP.vmx setguestinfo machine.id $(hostname)
setguestinfo(machine.id, himalaya.primp-industries.com) = 1
This sets the machine.id to the hostname of the ESX Server, in my example, it's called himalaya.primp-industries.com
Now you'll query this from a guest VM, in this example, it's a Windows XP:
C:\Program Files\VMware\VMware Tools>VMwareService.exe -cmd "info-get guestinfo.
machine.id"
himalaya.primp-industries.com
On UNIX/Linux hosts, I believe you'll need to run:
vmware-guestd --cmd "info-get guestinfo.machine.id"
You'll probably want to setup some type of cron job that'll automatically loop through all existing VMs and update this entry for any newly provisioned VMs, so that you'll ensure this variable is up to date.
=========================================================================
William Lam
VMware vExpert 2009
VMware ESX/ESXi scripts and resources at:
Twitter: @lamw
VMware Code Central - Scripts/Sample code for Developers and Administrators
VMware Developer Community

If you find this information useful, please award points for "correct" or "helpful".