Windows Server 2012 Install & Uninstall the GUI

We all know the Windows 2008 (R2) operating systems and I find them great to work with. Already, half of the sold licences for this product range has been installed as a virtual machine and its only getting more the next couple of years. This article wants to share with you the powershell way to enable and disable the GUI interface in Windows 2012. I will advise you all, to disable and uninstall the GUI, and the binairies, on every machine possible as it is not necessary to have a GUI or a role installed on remotely managed (virtual)machines that are not needed. It will only lower the security of your machine as it becomes more vulnerable for remote attackers. Let first start with an overview of the possible GUI layers within Windows Server 2012. Start reading, no hurry, all possible commands will be in this article.

Server Core In Server Core, basically, none of the GUI Server Features have been enabled and all of the GUI Server features have been disabled.

Minimal Shell (“MinShell”) In the Minimal Shell, previously known as ‘Features on Demand’, the ‘Graphical Management Tools and Infrastructure’ feature has been enabled. This feature has no dependencies on, or towards, the other GUI Features.

Full Installation In a full installation, both the ‘Graphical Management Tools and Infrastructure’ and ‘Server Graphical Shell’ feature has been enabled. The latter feature has a dependency on the first feature; If you install the ‘Server Graphical Shell’ feature when you are in a Server Core, the ‘Graphical Management Tools and Infrastructure’ will automatically be added.

Full Installation with Desktop Experience If you enable the ‘Desktop Experience’ feature when you are in a full installation, you add the Windows RunTime, the Windows Store and thus the ability to buy, download and run Apps in the Start Screen. Note, however, that there is no automatic dependency resolution for the Desktop Experience feature. And,...this feature can only be enabled when you are already in a full installation.

The easiest way to simply install the GUI is with a Powershell command. This can be done remotely but I personnaly never do that, as I want to see whats happening after my command. Just type in the word "sconfig" from your black command-box and you will get a pop-up, that's the default (blue) Core-tasks Powershell windows. Choose number 15, that's "Exit" and type in the word "Powershell". You will notice that the letters "PS" will be added in front of your (users)directory and you are in Core-Powershell.

In order to remove the GUI:Just type the next lines,...Import-Module SeverManagerUninstall-WindowsFeature Server-Gui-Mgmt-Infra, Server-Gui-Shell -Restart

The last restart parameter/option is optional but in my labs I find it necessary to complete the uninstall of the GUI. Just boot and watch it coming up in total core mode.

Above where the most used commands, but lets now cut that down to all the variables that we can have in Windows 2012. Lets start with downgrading a full installation of Windows Server 2012 and/or MinShell installation of Windows Server 2012 toward the Server Core with just one line of PowerShell:Uninstall-WindowsFeature Server-Gui-Mgmt-Infra -Restart

To convert a Full installation of Windows Server 2012 to MinShell, run the following PowerShell command:Uninstall-WindowsFeature Server-Gui-Shell –Restart

To go from Server Core to MinShell, all you need to do is install the Graphical Management Tools and Infrastructure:Install-WindowsFeature Server-Gui-Mgmt-Infra -Restart

To go from a Server Core installation of Windows Server 2012 or a MinShell installation of Windows Server 2012 to a Full Installation, simply add the Server Graphical Shell with the following command:Install-WindowsFeature Server-Gui-Shell –Restart

Now I guess you will understand the meaning of these Powershell cmdlets. Just play around with it in your testlab!Remember always that Server-Gui-Shell depends on the Server-Gui-Mgmt-Infra, and not the other way around.But we are not done yet!

The -Remove parameter:This is a special parameter that is new in Windows 2012 and it is quit special I think. We used to call this earlier "Features on Demand" I believe. When you use this parameter on uninstalling a role or feature, Windows 2012 server actually removes the binaries from the operating disk itself! Now an attacker cannot get to feature at all, assuming that they could break into your system, which they probably couldn't. What does this mean? I find it a great job of Microsoft. This really get the security much, much better on a server and there are less resources necessary on the machine. Less memory, less CPU, less processes running, less event errors, and as the machines will be remotely managed, the uptime will become a lot better! No more need to restart a server, just to get the lack of memory back, and trainees and junior administrators that keep forgetting to log off a session. Thumbs Up for Microsoft! But I'm deviating here, back to the -Remove parameter, I guess you can see the picture and benefits to removing the features completely. An example of the above mentioned powershell line, including the -Remove parameter.

Remember that removing the binaries from the disk itself, can only be done through Powershell and when you actually need to (re)install the feature again, you will have to connect the installation media to your machine again and type the complete path to the WIM file. This is easy when virtualiest, but remember this when you are executing these commands on a machine on your branche office in another part of the world.

DISM tool:For the readers that are familiar with the DISM tool,... You can do the same with DISM as mentioned above but this can be a pain in the xxx, when you never worked with it before. As most administrators never do,... I'm not going to explain that all here, but it is possible.

Using the GUI to (un)install the ServerManager/Core:Yes, you read it right,... It is still possible through the GUI to uninstall and disable the GUI itself and make the machine a core one. And yes, I wish they threw that out.. Hope this is temporary for 2012 Server and that the next generation will contain the MinimumShell as maximum setting. Back to the basics works for me! But as it is possible through the GUI, I will add this also to this article. Please note that it is almost at the button of this page. Uninstalling these features in the GUI is simple. Open the Server Manager from where your start-button used to be. Select "Manager" on the menubar on top and choose for "Remove Roles and Features". Skip the begin screen and select your server. Skip the "Role" page and stop at the "Feature" page. Scroll down to the "Userinterfaces and Infrastructure" option and notice that our shells are turned on. Remember, again, that when you turn of the Graphical Management Tools and Infrastructure as well as the Server Graphical Shell, you are creating a Server Core installation. Leave the "Server Graphical Shell" checkbox selected if you want to have the MiniShell still available on your system.

Start loving Windows 2012,... I'm convinced that you will love it, like I already do!

Ben Oostdam has been working with Windows systems since 1993. Worked for several companies as a system administrator, and is currently a Senior Support Engineer and a (Freelance) Trainer for a large company in the Netherlands.

Disclaimer: The information contained in this website/article is for general information purposes only. The information is provided as is, by Ben Oostdam and while we endeavour to keep the information up to date and correct, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the website for any purpose. Any reliance you place on such information is therefore strictly at your own risk. In no event will we be liable for any loss or damage including without limitation, indirect or consequential loss or damage, or any loss or damage whatsoever arising from loss of data or profits arising out of, or in connection with, the use of this website. Through this website you are sometimes able to link to other websites which are not under my control. I have no control over the nature, content and availability of those sites. The inclusion of any links does not necessarily imply a recommendation or endorse the views expressed within them. Every effort is made to keep the website up and running smoothly. However, I take no responsibility for, and will not be liable for, the website being temporarily unavailable due to technical issues beyond our control. All entries in these articles, are my individual opinion, or from co-writers and they don't necessary reflect the opinion of my employer.