This document shows you how to get the universally unique identifier (UUID) of a virtual machine (VM) instance by using a tool that is specific to the VM's operating system.
Each VM has a UUID that has the following properties:
It is unique among Compute Engine VMs.
It is generated from the VM's project ID, zone, and name.
It is stable for the lifetime of the VM. If the VM is deleted and recreated in the same project, zone, and with the same name, the VM receives the same UUID.
UUIDs are only available for VMs created on or after October 30, 2014. If you have a VM created before that date, recreate the VM so Compute Engine can assign it a UUID.
Use operating system tools to get the UUID of a VM
To get the UUID of a VM, run the command that corresponds to the VM's operating system:
Linux
From the Linux VM, run the following
dmidecode
command:sudo dmidecode -t system | grep UUID
Verify a response similar to the following:
UUID: 3748eb17-a207-5bc3-aa4f-3113a1b9409d
Windows (Cmd.exe)
From the Command Prompt on the Windows VM, run the following
wmic
command:wmic path win32_computersystemproduct get uuid
Verify a response similar to the following:
UUID 81CBB42C-73A0-9660-6C7D-2FE94627F3A3
Windows (PowerShell)
From PowerShell, run the following Windows Management Instrumentation (WMI) command:
(Get-WmiObject -Class Win32_ComputerSystemProduct).UUID
Verify a response similar to the following:
81CBB42C-73A0-9660-6C7D-2FE94627F3A3