c++ - 如何检测Windows 2012 Core 版(C++)

标签 c++ core windows-server

我需要在我的程序中检测 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 无图形用户界面模式。

关于c++ - 如何检测Windows 2012 Core 版(C++),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13065479/

相关文章:

windows批量比较md5sum和md5文件内容

postgresql - 安装在 windows server 2016 服务器上时如何设置 postgresql 复制

swift3 - Swift 3 将 double 转换为字符串

crash - 调试崩溃时在gdb中的<Optimized OUT>

java - 将 JRE 与 Java 应用程序捆绑在一起

powershell - 如何使用Powershell向Windows服务器上的域帐户授予SeBatchLogon特权?

用于 Apache Drill 的 Java 或 C++ API

c++ - 异常 : Deletion of node in Binary Search Tree

C++ 在 unique_ptr 的映射上迭代 std::accumulate():没有已知的转换

c++ - float 的最小正值?