There are many reason why an organization would want to use a Core install of Windows Server 2012 R2 be it a smaller footprint, or attack surface or even reduced management overhead. Lets face it doing everything over command line just plain sucks and you would rather do it via GUI.
If you are like me and have that mentality to have both Core functionality & security but also don't like doing things via command lines & powershell scripts here is a way to get the job done.
By default all features are stored in the %windir%\winsxs directory, but administrators can use the uninstall-windowsfeature <featurename> –remove command to delete the files associated with that feature from the winsxs directory.
Enable GUI on Core Install of Windows Server 2012 R2
Windows Server 2012 R2 Installation Media / ISO (OR Just the /sources/install.wim file.
Method 1: Via Command line
- Mount the Windows Server 2012 ISO to the host.
- open an administrative command prompt
- mkdir c:\mount
- check your wimfile to determine the correct index for the OS (mine was 4) -the command is dism /get-imageinfo /ImageFile:d:\sources\install.wim
- ‘dism /mount-wim /wimfile:d:\sources\install.wim /index:4 /mountdir:c:\mount /readonly
- powershell (enter PowerShell prompt)
- install-windowsfeature server-gui-mgmt-infra,server-gui-shell –restart –source c:\mount\windows\winsxs
- Unmount Wim (dism /unmount-wim /mountdir:c:\mount)
- Remove Mount Directory (rmdir c:\mount)
Method 2: Via Powershell
Disable GUI on Core Install of Windows Server 2012 R2
- Launch Server Manager, Click on Manage, and then select Remove Roles or Features from the menu.
- Click on next to skip past the "before you begin page", then select your server from the server pool and click next.
- Click on Next again to skip past the "Server Roles" since GUI is not a role.
- In Features section, Uncheck the box next to User Interfaces & Infrastructure. Then click next.
- Check the "Restart the destination server automatically if required" So that you don't have to manually restart the server & You will need to restart the server after removing the GUI.
- The GUI will now be removed & upon reboot you will see the below screen.
You can do this as many times as you like.