Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Determining Whether Server Core Is Running

Use the GetProductInfo function to retrieve the product information for the current operating system. If Server Core is running, one of three values will be returned by GetProductInfo: PRODUCT_DATACENTER_SERVER_CORE, PRODUCT_ENTERPRISE_SERVER_CORE, or PRODUCT_STANDARD_SERVER_CORE. Calling GetProductInfo is the recommended way to test if Server Core is running.

Another way to test if Server Core is running is to check for the presence of Explorer.exe on the local file system. If Explorer.exe is not present, then Server Core is running. This method can be used if you are using a scripting language.

The following VBScript sample checks for the presence of Explorer.exe on the local file system.

Dim bServerCore, bExplorer

Const strExplorer =  "\explorer.exe"
strRoot = WshEnv("%SYSTEMROOT%")
strExpPath = strRoot + strExplorer

Set objFSO = CreateObject("Scripting.FileSystemObject")

If objFSO.FileExists(strExpPath) Then
    'Explorer.exe is present, Server Core is not running
    WScript.Quit (0)
    bServerCore = False                 
    bExplorer = True
    bServerCore = True
    bExplorer = False
End If

Related topics

Developing Applications for Server Core



© 2015 Microsoft