如何获取 windows 服务器的 'Release ID'?

How to get the 'Release ID' of a windows server?

我无法找到 windows 服务器 2012 R2 标准的发布 ID(构建版本,看起来像“1511”或“1803”)我需要它来形成其 CPE(通用平台枚举) .

由于不熟悉所有这些并且没有取得这样的成功,我也不确定该尝试什么。 为了在 windows 10 上获取此版本 ID,我使用了 REG 查询并自动执行它,我将 python 与子进程一起使用。

这是我用来获取版本 ID 的命令:

'Reg Query "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ReleaseId'

它成功地为我提供了 windows 10 的预期结果,但对于 windows 服务器它给出了:

ERROR: The system was unable to find the specified registry key or value.

如果仅适用于 Win 10 和 Windows Server 2016 或更高版本,我相信 Release Id(又名 Windows 10 Release Id,格式为 YYMM)。

也许您的命名基于主要/构建版本号?

所有版本的table:

嘿@rockangator 在 www.google.com 上给出了 python 中的一个简单代码,因为这个问题根本无法理解,你已经写在这里..下次尝试更具体请