如何检测Windows 2012核心版(C)

前端之家收集整理的这篇文章主要介绍了如何检测Windows 2012核心版(C)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我需要在我的程序中检测 Windows 2012上的版本.
在以前的操作系统中,我使用了GetProductInfo的pdwReturnedProductType,但根据msdn:

PRODUCT_*_SERVER_CORE values are not returned in Windows Server 2012. For example,the base server
edition,Server Datacenter,is used to build the two different installation options: “full server”
and “core server”. With Windows Server 2012,GetProductInfo will return PRODUCT_DATACENTER
regardless of the option used during product installation.

有没有其他可能检测核心版本?
谢谢.

解决方法

HKLM\Software\Microsoft\Windows NT\CurrentVersion\Server\ServerLevels\
    ServerCore = 1
    Server-Gui-Mgmt = 1
    Server-Gui-Shell = 1

根据MSDN使用这些注册表值是一种方法.另一种方法是解析dism / online / get-features / format:table的输出,看看是否启用或禁用了功能ServerCore-FullServer.如果它被禁用,那么你处于servercore gui-less模式.

猜你在找的Windows相关文章