Ask Learn
Preview
Please sign in to use this experience.
Sign inThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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.
[Visual Basic]
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
Else
bServerCore = True
bExplorer = False
End If
Developing Applications for Server Core
Send comments about this topic to Microsoft
Build date: 2/28/2008
Please sign in to use this experience.
Sign in