How can I distinguish between Windows Server & Windows Server Core machines?

Rohan Pande 445 Reputation points
2024-08-06T05:40:56.4733333+00:00

Hi,

I am trying to create a C++ application which is an interactive application. My use case is that I don't want to run the application on Windows Server Core but should be possible running on Windows Server machine.

Even if the user has started it on Windows Server core just want to inform him with some message like 'running the wrong application' via some logs.

So, for that wanted to know how can I distinguish between these machines?

C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,760 questions
Not Monitored
Not Monitored
Tag not monitored by Microsoft.
39,712 questions
0 comments No comments
{count} vote

Accepted answer
  1. Minxin Yu 12,086 Reputation points Microsoft Vendor
    2024-08-07T01:30:28.6333333+00:00

    Hi, @Rohan Pande

    Please check the Previous Versions document:
    https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/ee391629(v=vs.85)

    Another way to test if Server Core is running is to check the registry under HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion for the value of InstallationType. If it is set to "Server Core", then the Server Core installation option is installed.

    Since the document is no longer updated, there is no guarantee that this will change in future updates of Windows Server.

    Best regards,

    Minxin Yu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


2 additional answers

Sort by: Most helpful
  1. Adharsh Santhanam 4,370 Reputation points
    2024-08-06T06:22:09.73+00:00

    Hello Rohan Pande, you can query the Windows Registry to check for specific keys that indicate whether the system is running Server Core or the full Windows Server with Desktop Experience. For example, you can check the InstallationType value in the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion registry key. The value will be “Server Core” for Server Core installations and “Server” for full installations.

    Please do not forget to "Accept the answer” and “up-vote” wherever the information provided helps you, this can be beneficial to other community members.


  2. Castorix31 85,881 Reputation points
    2024-08-06T07:30:38.44+00:00

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.