It's easy to tell whether Windows Server 2008 is installed as Server Core. I know what you're thinking: "Duh! it only shows a command prompt window after you log on", but that's not what I wanted to show you today. What if you wanted to find out programmatically? What if you're WinRS'ing into a Windows Server 2008 box?
Not the way to do this
I fiddled a bit to retrieve this information from my systems but couldn't find a difference between full installations and server core installations when I used the following commands:
wmic OS get Caption
wmic OS get Name
systeminfo
Sure, I gathered a lot of information on the box and the Operating System I have installed, but couldn't find a shred of information on how the Operating System was installed in terms of a Server Core installation or a Full Installation.
The way to do this
The solution to determine whether you're dealing with a Server Core box, is to type the following command:
wmic OS get OperatingSystemSKU
When it returns any of the following values it's a Server Core box:
OperatingSystemSKU (output on console) |
OperatingSystemSKU (hexidecimal value) |
Server Core Edition |
12 | 0x0000000C | Windows Server 2008 Datacenter Edition, Server Core |
39 | 0x00000027 | Windows Server 2008 Datacenter Edition without Hyper-V, Server Core |
13 | 0x0000000D | Windows Server 2008 Standard Edition, Server Core |
40 | 0x00000028 | Windows Server 2008 Standard Edition without Hyper-V, Server Core |
14 | 0x0000000E | Windows Server 2008 Enterprise Edition, Server Core |
41 | 0x00000029 | Windows Server 2008 Enterprise Edition without Hyper-V, Server Core |
29 | 0x0000001D | Windows Web Server 2008, Server Core |
I agree a couple of other dead give-aways exist (checking for the existence of oclist.exe or SCregEdit.wsf would suffice as well) but none of these are really decent…
Concluding
When determining whether a server is a Server Core remotely isn't as simply as typing a command and getting it served on a silver platter. You need to actually decipher a value using the table provided here.
What a pity this isn't easier…
Further Reading
GetProductInfo Function using wmic path win32_Operatingsystem get OperatingSystemSKU
Windows Server 2008: Compare Server Core Installation Options
Core flavors of Windows Server 2008
MSDN Application Compatibility: Windows Server 2008 Server Core
# Is GUI server?
(Get-WindowsFeature -Name Server-Gui-Shell).Installed