Thursday, September 03, 2015

Group Policy WMI Filter for Server Core vs GUI on Windows Server 2012 R2

Windows Server 2012 R2 makes it "easy" to transition between a core server and one with varying states of GUI. Unfortunately this makes it harder to apply GPOs to machines since the old SKU filters will no longer work (for example setting PowerShell as the default shell on core servers). Luckily you can query the installed features on the machine directly to check what type of server it currently is: 

Server Core

Select * from Win32_OptionalFeature WHERE Name = "Server-Gui-Shell" AND InstallState = 2

Some to full GUI

Select * from Win32_OptionalFeature WHERE Name = "Server-Gui-Shell" AND InstallState = 1