Find, Convert And Compare, VMware Virtual Machine And Windows Guest UUID
What’s UUID?
Each virtual machine has UUID and it will appear on OS as guest UUID too.
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer systems, the 16 bytes of this value are separated by spaces. Microsoft uses the term globally unique identifier (GUID), either as a synonym for UUID or to refer to a particular UUID variant.
Find VMware UUID
VMware virtual machines using BIOS or UEFI same as physical computers and it will be cloned to guest operating system after installation. UUID can be changed manually but it’s absolutely not recommended. Just if there is two machines with same UUID, UUID on one of them should be changed.
UUID will assign to each machine after first power on.
For changing UUID and read more about UUID, read the below links:
Changing or keeping a UUID for a moved virtual machine
VMware Workstation 5.0 Virtual Machine Identifier — UUID
Now, how can you find UUID of virtual machines?
There is some simple ways to find VMware virtual machine’s UUID:
- PowerCLI: Run the below simple command to find VM’s UUID:
Get-VM <vm_name> | %{(Get-View $_.Id).config.uuid}
This will work even machine is powered on.
- Open or edit VM’s vmx file and find “uuid.bios”:
- Use RVTools or other reporting software to export VM’s information from ESXi server or vCenter.
Actually, I don’t know that there is other way or not! but follow the above instruction to find VM’s UUID.
Find Windows Guest UUID
As Windows and other OS has different algorithm to clone and restructuring BIOS UUID, OS UUID is different in view but actually the value is BIOS UUID!
There is some way to find UUID in Windows but this is simplest:
- Use “Windows Management Instrumentation Command-line“:
wmic csproduct get name,identifyingnumber,UUID
Actually, VMware UUID will show at this step too.
Compare VMware And Guest UUID
As I mentioned before, guest UUID and VMware VM UUID is different in view. So the value should be converted to a proper format.
Convert Windows Guest UUID To VMware
Param ( [Parameter(Mandatory=$True)] [String] $winUUID ) # Create an array of each section (hyphen delimiter) $section = $winUUID.Split("-") $j=0 ForEach ($i in $section) { $k = $i -split '(..)' | ? { $_ } # Create array by splitting on every 2 characters If ($j -lt 3) { # First 3 sections need to be reversed. i.e first section array(2A, 3B, 4C) becomes array(4C, 3B, 2A) [array]::Reverse($k) } $section[$j] = $k -join(' ') # Convert array to string and add space inbetween. i.e array(4C, 3B, 2A) becomes string "4C 3B 2A" $j++ } # Build the final string, piecing together section by section $vmxUUID = $section[0] + ' ' + $section[1] + ' ' + $section[2] + '-' + $section[3] + ' ' + $section[4] Return $vmxUUID
Convert VMware UUID To Windows Guest
Param ( [Parameter(Mandatory=$True)] [String] $rawUUID ) # Create an array of each half (hyphen delimiter) $octets = $rawUUID.Split("-") # Create an array of each two-character byte (space delimiter) $bytes = $octets[0].Split(" ") + $octets[1].Split(" ") # Build the final string, piecing together byte by byte $prettyUUID = $bytes[3] + $bytes[2] + $bytes[1] + $bytes[0] + "-" + $bytes[5] + $bytes[4] + "-" + $bytes[7] + $bytes[6] + "-" + $bytes[8] + $bytes[9] + "-" + $bytes[10] + $bytes[11] + $bytes[12] + $bytes[13] + $bytes[14] + $bytes[15] Return $prettyUUID
The script was imported from this link.