Recover GUI in windows 2012 and 2012 R2



Windows Server 2012 includes .NET Framework 4.5 and Windows Server 2012 R2 includes .NET Framework 4.5.1. The .NET Framework provides a comprehensive and consistent programming model to build and run applications (including Roles and Features) that are built for various platforms. Windows Explorer (Graphical Shell), Server Manager, Windows PowerShell, IIS, ASP .NET, Hyper-V, etc, are all dependent on .NET Framework. Since there are multiple OS components dependent on.Net Framework, this feature is installed by default. Therefore, you do not have to install it separately.
It is not recommended to uninstall .NET Framework. In some given circumstances, there may be a requirement to remove/ re-install.Net Framework on Windows Server 2012/2012 R2.
When you uncheck the .NET Framework 4.5 checkbox in the Remove Roles/Features Wizard of Server Manager, Windows will check all roles/features that may also be installed as it would need to be removed as well... If there are other roles or features dependent on .NET Framework, those would be listed in this additional window.
it will leave the server installed in Core and you will be able to get the command prompt only.
For Example:
If you read through the list, the components that are affected by this removal are listed as follows:
  1. .NET Framework 4.5 Features
  2. RSAT (Remote Administration Assessment Toolkit) which includes Hyper-V Management tools and Hyper-V GUI,
  3. User interfaces and Infrastructure, which includes Graphical Management Tools and Infrastructure Server Graphical Shell (Full Shell and min Shell),
  4. PowerShell which will remove complete PowerShell 4.0 and ISE
The list of components may differ depending upon the Roles and Features installed on the Server machine.
How to recover from this situation and to bring back the power shell, .net feature, and UI in 2012, 2012U1
As stated earlier, this will leave the server without a graphical shell for user interaction. Only the command prompt will be available post reboot.
If you get into this situation, run the below commands in the Server Core’s command prompt window to help you recover:
i) Run the below commands one by one
DISM.exe /Online /enable-feature /featurename:NetFx4 /all
DISM.exe /online /enable-feature /featurename:MicrosoftWindowsPowerShell /all
ii) Reboot the server
iii) To restore the GUI need to run the PowerShell commands. Below procedure how to open PowerShell prompt in server core’s command prompt
a) To begin, press CTRL-ALT-Del and select Task Manager from the list
b) Once Task Manager Opens select File and Run new task
c) You should now see the Create new task menu, type PowerShell.exe and select OK
d) PowerShell prompt should now be open
iv) Run the below commands on the PowerShell prompt
Install-WindowsFeature Server-Gui-Shell
Install-WindowsFeature Server-Gui-Mgmt-Infra
v) Once the GUI Shell is installed, you will need to restart the server with the following command:
Restart-Computer
To make things faster, put the time switch at 0: shutdown -r -t 0