Windows 10的注册表版本值?



我想从注册表中获取Windows 10操作系统版本。我正在阅读下面的注册表项使用c#代码来获得它:

SOFTWAREMicrosoftWindows NTCurrentVersionEditionID
下面是c#代码:
using (var key = Registry.LocalMachine.OpenSubKey(@"SOFTWAREMicrosoftWindows NTCurrentVersion"))
{
if (key != null)
{
var keyValue = key.GetValue("EditionID");
var osEdition = keyValue.ToString();
}
}

我需要知道将出现在EditionID中的字符串Windows 10不同版本的密钥。我找不到任何相关的微软文档。Windows 10的主要版本如下:

  1. Windows 10 Pro
  2. Windows 10 Pro for workstation
  3. Windows 10教育
  4. Windows 10 Pro Education
  5. Windows 10企业版
  6. Windows 10 Enterprise 2019 LTS/LTSC/LTSB
  7. Windows 10 Home

我的电脑上有一个Enterprise版本的Windows 10操作系统。所以我知道对于Enterprise版本,这个注册表值是Enterprise。我需要知道剩下的。

我知道Windows Enterprise LTSC有一个版本id为" enterprises ";

我在LattePanda上运行的一个版本上发现了这个问题。

我已经能够获得其中的一些。如果你发现有人安装在你的办公室、学校或家里,请随时编辑这篇文章。

  • Windows 10 Pro -Professional
  • Windows 10 Pro for workstation -ProfessionalWorkstation
  • Windows 10教育-教育
  • Windows 10 Pro Education -ProfessionalEducation
  • Windows 10企业版-企业版
  • Windows 10 Enterprise 2019 LTS/LTSC/LTSB -EnterpriseS
  • Windows 10 Home -Home

确认Windows 10 Pro for workstation -ProfessionalWorkstation

鉴于您试图解决的问题的描述和我试图做类似的事情的事实,我在仪表管理中偶然发现了Win32_OperatingSystem类。

var query = new SelectQuery("SELECT * FROM Win32_OperatingSystem");
var searcher = new ManagementObjectSearcher(query);
var results = searcher.Get().OfType<ManagementObject>().First();

之后可以使用"Caption"属性获取所安装Windows版本的确切字符串。我有三个例子:

  • 10 Enterprise Multisession = Microsoft Windows 10 Enterprise for Virtual desktop
  • Regular 10 Enterprise = Microsoft Windows 10 Pro
  • Server 2012R2 = Microsoft Windows Server 2012R2 Standard

你也可以在这个类的其他属性中寻找你需要的信息。