Each virtual machine is automatically assigned a universally unique identifier (UUID), which is stored in the SMBIOS system information descriptor. It can be accessed by standard SMBIOS scanning software (for example, SiSoftware Sandra or the IBM utility smbios2) and is used for system management in the same way you use the UUID of a physical computer.
The UUID (128-bit integer) is based on the physical computer’s identifier and the path to the virtual machine’s configuration file. This UUID is generated when you power on or reset the virtual machine. As long as you do not move or copy the virtual machine to another location, the UUID remains constant.
If you move or copy the virtual machine, you may be offered the choice of creating a new UUID or keeping the old UUID when you first power on the virtual machine. This new UUID is based on the physical computer’s identifier and path to the virtual machine’s configuration file in its new location.
CLS
$VM = Get-VM
Foreach ($_ in VM)
{
Write-Host $_.Name, (Get-View $_.id).config.uuid
}