VMware Cloud Community
admin
Immortal
Immortal

finding uuid of vm

How can I find the uuid of a vm installed on ESX 3.5? I could see this id through the configuartion file of the vm, but is there a command that provides this info?

Thanks!

0 Kudos
2 Replies
lamw
Community Manager
Community Manager

You can use "vmware-cmd" to do a "getconfig" on "uuid.location" and awk out the 3rd column. If you want to get all UUID values you can do the following:

#!/bin/sh

IFS=$'\n'

for vm in `vmware-cmd -l`;

do

VM_NAME=`vmware-cmd -l "$vm" getconfig displayName | awk '{print $3}'`

VM_UUID=`vmware-cmd -l "$vm" getconfig uuid.location | awk '{print $3}'`

echo -e "$VM_NAME\t$VM_UUID"

done

unset IFS

dmn0211
Enthusiast
Enthusiast

Using the VI toolkit

Get-VM <vm_name> | %{(Get-View $_.Id).config.uuid}