Uninstall GUI from Windows Server 2012 R2
Some programs require the desktop environment to be present. Otherwise the installation procedure doesn’t work. I came across such a program and was forced to install it on a server with GUI installed. Later I realized that the program itself doesn’t require the GUI (at any time), so i decided to remove the GUI. Here’s how:I’ll show how to do it via PowerShell only. The only way to learn PowerShell it is to use it.
Cmdlet used to achive this is ‘Uninstall-WindowsFeature’ (or it’s alias ‘Remove-WindowsFeature’). In my case, I want to remove both GUI Shell and GUI Management Tools and Infrastructure. Run PowerShell in elevated mode and list the features in order to get the percise feature name:
PS C:\Users\tpl-adm> Get-WindowsFeature -Name *gui* Display Name Name Install State ------------ ---- ------------- [X] Graphical Management Tools and Infrastructure Server-Gui-Mgmt-Infra Installed [X] Server Graphical Shell Server-Gui-Shell Installed PS C:\Users\tpl-adm>
Because I know that the uninstall requires a restart, ill use the ‘-restart’ parameter, and I’ll simply pipe the results of ‘Get-WindowsFeature’ to ‘Uninstall-WindowsFeature’
Get-WindowsFeature *gui* | Remove-WindowsFeature -Restart
If you plan on installing it again at the later time, you’re done. Else you can use the ‘-Remove’ parameter .
Get-WindowsFeature *gui* | Remove-WindowsFeature -Restart -Remove
This will delete the feature from the side-by-side store (“$env:windir\WINSXS”).
Server Core | Minimal Server Interface | Server with a GUI | Server with a GUI with Desktop Expirience | |
---|---|---|---|---|
Avaliable tools | Command Prompt, Windows powerShell, .NET Framework | MMC, Server Manager, several Control Panel applications | Windows Explorer, Internet Explorer, Task Bar, Control Panel | Windows Media Player, Themes, Windows 8 shell, Windows Store |
PowerShell Features | None | Server-Gui-Mgmt-Infra | Server-Gui-Mgmt-Infra, Server-Gui-Shell | Server-Gui-Mgmt-Infra, Server-Gui-Shell, Desktop-Expirience |
Server Manager Features | None | Graphical Management Tools and Infrastructure | Graphical Management Tools and Infrastructure, Server Graphical Shell | Graphical Management Tools and Infrastructure, Server Graphical Shell, Desktop Expirience |
It is not recommended to install the desktop experience on a production server unless there is a real-life, honest compelling business reason for doing so.