Converting Server with a GUI to Server Core (Should know)
This recipe explains the procedure to convert the Server with a GUI into Server Core using a PowerShell cmdlet.
Getting ready
The minimum hardware and software requirements for a Server with a GUI is the same as a Server Core which is described in the previous recipe.
How to do it...
- Log on to the Windows Server 2012 server with administrative credentials.
- Start the PowerShell console from the command window by typing the command
PowerShell
. - From the PowerShell prompt, enter the
Uninstall-WindowsFeature Server-Gui-Mgmt-Infra –restart
cmdlet. - Restart the server.
How it works...
The preceding process uninstalls the Server-Gui-Mgmt-Infra feature and the associated components from the server. If you are not sure which components will be affected by this cmdlet, you can use the –whatif
parameter with the previous command.
As you can see in the following screenshot, if we use the previous command, it will remove Graphical Management Tools and Infrastructure, Server Graphical Shell, User Interfaces and Infrastructure, and Windows PowerShell ISE.
You can specify a –Remove
option with the preceding command to remove the installation binaries from the hard drive (disabled with payload removed). If you don′t specify the –Remove
option, the installation binaries will remain in the Windows Side-by-Side (WinSxS
) folder. It can be used for future use without using an installation media or getting it from Windows Update.
There′s more...
You can verify the installation type by validating the ServerCore
, ServerCoreExtended
, Server-Gui-Mgmt
, and Server-Gui-Shell
registry values in the HKEY_LOCAL_MACHINES\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Server\ServerLevels
registry hives. These registry keys will be added based on the features installed on the server.
A Windows Server with a GUI will have ServerCore
, ServerCoreExtended
, Server-Gui-Mgmt
, and Server-Gui-Shell
registry keys as shown in the following screenshot. The Server Core will only contain the ServerCore
registry key.
You can also use Server Manager from a local or remote machine to add or remove a feature on a server. The Deployment Image Servicing and Management (DISM) command Enable-WindowsOptionalFeature –online -Featurename ServerCore-FullServer, Server-Gui-Shell, Server-Gui-Mgmt
can also be used to install additional features on a server.