This is a question I get a lot, should I start with windows server core? Or should I install it with a UI, configure it, and then go to core. As always in Tech world… It depends. If you can deploy machines with the right settings (domain join, network settings, firewall settings, rdp settings, storage config…), in other words, the baseline image that matches your environment, then why should you bother using the UI in the first place. After the initial deployment, you connect with your remote server manager and tools (that’s a topic for later on…) and you are good to go and can continue doing what you need to do.
Unfortunately, not everyone has that possibility and today there are still a lot of companies that need to deploy manually, or have a very basic baseline and still need to configure additional settings depending on what role the server will take. In that case, unless you like to configure everything through commands and PowerShell, I advice to start in UI mode.
As I said in my previous post there is the possibility to switch to another mode. Since server core is kind of the underlying server stack and the MinShell and full UI are more or less roles on top of that, you can remove (or add) those roles very easily.
So let’s go back to our example. We have deployed windows server with the UI using your preferred deployment method, you have added the Hyper-V role on top of it (although this can be done remotely also…) and configured the storage connections, network connections and everything else you need to do. Now the only thing left to do is patching and your server is ready for use…
OK, I don’t agree on the patching part… As we said in the previous post there will be less patches when you are running in Core mode, so why go through the trouble of patching an entire server while you can do it when it is in core mode so you need to do less patching and loose less time. I’ll come back to that. First, I want to go to core with my full-blown server.
There are two ways to remove these roles… (There are actually three, you can also use DISM but I’ll skip this one…). You have the UI way, and the PowerShell way. Note that you only can use the UI way when you are actually using a UI, so it is certainly better to learn how to do it in PowerShell.
The UI way
For the UI way, it is very simple. Go to Remove Roles and Features (from Server Manager for example), select your server, go over the Server Roles and when you are at the Features page of the wizard, you will find User Interfaces and Infrastructure
Deselect Graphical Management Tools and Infrastructure and Server Graphical Shell. Note that it is perfectly possible that you will get a warning that certain other features and roles need to be de-installed also. If you installed the Hyper-V role and the tools, the tools need to be removed. If you have PowerShell ISE running, it will need to be removed… And there are other features, tools and roles that can’t run on a core server. In that case, review the box very well and make sure you are not removing a component that is actually needed on that server. In that case, this server is not meant to be core
Finish the wizard, know that it will reboot afterwards and then you are in core mode.
The PowerShell way
For the PowerShell way, it is actually also very simple.
Uninstall-windowsfeature -name Server-GUI-Mgmt-Infra,Server-GUI-Shell
Note that you probably won’t need to use the Import-Module CmdLet because you probably will run this directly on the server. And the last command is necessary to restart the computer, but I am sure you know other ways to do this
But let me give some more background. To know what kind of roles and features are installed, you can simply type in a PowerShell window the command Get-WindowsFeature
As you can see in the screenshot above, you get all the roles and features listed with upfront some sort of checkbox. When there is an X between the brackets [X] it means the role / feature is installed. So when I scroll down I will find this:
In this screenshot you see that Server Graphical Shell and Graphical Management Tools and Infrastructure is installed.
To make it a bit more easier, we can search more granular and use
Get-WindowsFeature -name *GUI*
And now for the updates
After the restart, we have our core server running… Now on to the patching part as I promised. I am sure that many of you will have a favorite method of patching, but in case you want to do it manually…
I could say PowerShell again, but unfortunately, for some dark reason MSFT did not put this functionality in PowerShell (yet?). Now you can download this module https://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc and use PowerShell anyway, but when you are a bit like me, you don’t like additional stuff being installed on a server so I like to use other methods.
But in the end, it is still very simple. Open a RDP connection to server core, and type in sconfig in the command prompt
Press number 6
Choose A for all updates or R for recommended updates and let the script do its magic.
Now you can choose which updates you want to install… Choose A for all updates, N for no updates or select a specific one by using S
Finally you will be able to reboot after the installation.