Networking

How to switch between GUI and Core in Windows Server 2012 using PowerShell

Learn how to use PowerShell to switch between Server Core and GUI versions on Windows Server 2012.

Image: Jesus Vigo/TechRepublic

Several years ago, Microsoft promised to shore up the security of its Windows OS line, particularly doubling down on Windows Server. The focus on security has brought about many changes, and one of the most interesting is the Server Core installation and how enabling it limits the attack surface of a server greatly.

At the heart of the Server Core installation is the lack of GUI or GUI management tools. Since enabling it means the Windows Explorer shell is not loaded, a Windows Server with Server Core installed is manageable only via the Command Line, PowerShell locally. Additionally, it may be managed by connecting to the server remotely through the Microsoft Management Console (MMC) or Remote Server Administration Tools (RSAT).

Let's review the commands to enable or disable Server Core using PowerShell.

Enable Server Core from Server GUI

1. Log on to your server with an account that has administrative rights on that server.

2. Run PowerShell as an Administrator and elevate User Account Control permissions, if prompted.

3. Uninstalling the two Windows features that are associated with Server GUI (Server-Gui-Shell and Server-Gui-Mgmt-Infra) will enable Server Core. The features may be uninstalled individually by replacing *gui* after the -Name switch below or uninstalled together by entering the following command and pressing Enter to process the command.

Get-WindowsFeature -Name *gui* | Remove-WindowsFeature -Restart

Figure A

guicorewinserver2012figa031516.jpg

Figure B

guicorewinserver2012figb031516.jpg

4. Once the uninstallation has completed, the server will need to reboot; the -Restart argument will carry out that operation automatically. After reboot, the server will display the logon screen as usual, except in Server Core after authenticating, only the command prompt will be displayed.

Enable Server GUI from Server Core

1. Log on to your server with an account that has administrative rights on that server.

2. Run PowerShell as an Administrator and elevate User Account Control permissions, if prompted. It may be necessary to call PowerShell using the runas command in order to specify administrative access elevation; this will depend on the configuration of your server. Enter the following command, and enter your admin password when prompted.

runas /user:administrator powershell.exe

3. Once PowerShell is loaded with administrative privilege, you will need to reinstall the Windows features associated with Server GUI. Enter the following command, and press Enter to process the command.

Get-WindowsFeature -Name *gui* | Install-WindowsFeature -Restart

Figure C

guicorewinserver2012figc031516.jpg

Figure D

guicorewinserver2012figd031516.jpg

4. Upon completing the installation, the server will be rebooted, and the logon screen will be displayed. After authenticating, the server OS will load like normal, with access to the Windows Explorer shell restored.

As a security measure, Server Core may be enabled or disabled as needed simply by entering the commands above and restarting the server. This reduces the attack surface of the OS by not loading the Windows Explorer shell, which will help to minimize security vulnerabilities.

Also see

About

Jesus Vigo is a Network Administrator by day and owner of Mac|Jesus, LLC, specializing in Mac and Windows integration and providing solutions to small- and medium-size businesses. He brings 15 years of experience and multiple certifications from seve...

Editor's Picks

Free Newsletters, In your Inbox