本页面上的部分或全部信息可能不适用于 Trusted Cloud by S3NS。
获取虚拟机的 UUID
本文档介绍如何使用虚拟机操作系统专用的工具获取虚拟机 (VM) 实例的通用唯一标识符 (UUID)。
每个虚拟机都有一个具有以下属性的 UUID:
它在 Compute Engine 虚拟机中是唯一的。
该 ID 根据虚拟机的项目 ID、可用区和名称生成。
它在虚拟机的生命周期内保持不变。如果在同一项目、可用区中使用相同的名称删除并重新创建虚拟机,则虚拟机将收到相同的 UUID。
UUID 仅适用于 2014 年 10 月 30 日或之后创建的虚拟机。如果您在该日期之前创建了虚拟机,请重新创建虚拟机,以便 Compute Engine 可以为其分配 UUID。
如需获取虚拟机的 UUID,请运行与虚拟机操作系统对应的命令:
Linux
从 Linux 虚拟机运行以下 dmidecode
命令:
sudo dmidecode -t system | grep UUID
验证是否收到类似如下所示的响应:
UUID: 3748eb17-a207-5bc3-aa4f-3113a1b9409d
Windows (Cmd.exe)
在 Windows 虚拟机上的命令提示符中,运行以下 wmic
命令:
wmic path win32_computersystemproduct get uuid
验证是否收到类似如下所示的响应:
UUID
81CBB42C-73A0-9660-6C7D-2FE94627F3A3
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-08。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-08。"],[[["This guide provides instructions on how to retrieve the Universally Unique Identifier (UUID) of a virtual machine (VM) instance using operating system-specific tools."],["Each Compute Engine VM has a unique and stable UUID, which is generated from the VM's project ID, zone, and name, and remains consistent throughout the VM's lifetime."],["For Linux VMs, you can use the `dmidecode` command to obtain the UUID, while for Windows VMs, you can use either the `wmic` command in the Command Prompt or a Windows Management Instrumentation (WMI) command in PowerShell."],["VMs created before October 30, 2014, do not have UUIDs and will require recreation to be assigned one."]]],[]]