Add a GUI to Microsoft Windows 2012 R2 Core / Standard

There was a server with Microsoft Windows 2012 R2 Standard installed with GUI, for some unknown reason the GUI was uninstalled along with PowerShell.  To reinstall or install these "features", the install.wim file is needed.  Using a mounted Windows 2012 R2 Standard ISO is one such way. These are the steps to "recover" the GUI and PowerShell.  Since PowerShell is key to reinstalling the GUI, the first focus is to get PowerShell installed.

Determine Windows Version

The ISO may have multiple versions.  The following command will determine which are available to you and which you may need to install the features.

dism /get-imageinfo /ImageFile:d:\sources\install.wim

Install PowerShell

This may not be true for everybody; however, I wasn't uable to use powershell until I restarted Windows.  Maybe logging out and back in may have been enough for the environment variables to take.

dism.exe /online /enable-feature /featurename:MicrosoftWindowsPowerShellRoot
dism.exe /online /enable-feature /featurename:MicrosoftWindowsPowerShell /all
shutdown /r /t 00

Install GUI

Launch PowerShell to install the server GUI and Management Infrastructure. Then reboot

powershell
Install-WindowsFeature Server-Gui-Mgmt-Infra, Server-Gui-Shell -Source:wim:D:\sources\install.wim:2
Restart-Computer

Bonus

The following will add desktop icons support.  If you are one of those who like the "Computer", "Recycle Bin", "My Files", and "Network" then this is for you.  Be patient, this may take awhile. Run PowerShell as administrator or elevated privileges.

Add-WindowsFeature Desktop-Experience

Source(s)

  • https://serverfault.com/questions/431010/server-2012-server-core-powershell-not-installed
  • http://www.wackytechtips.com/server-2012-r2-core-install-to-full-gui/
  • https://www.itprotoday.com/compute-engines/q-how-can-i-quickly-find-any-wim-files-are-mounted-using-deployment-image-servicing