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.
For Example:
If you read through the list, the components that are affected by this removal are listed as follows:
- .NET Framework 4.5 Features
- RSAT (Remote Administration Assessment Toolkit) which includes Hyper-V Management tools and Hyper-V GUI,
- User interfaces and Infrastructure, which includes Graphical Management Tools and Infrastructure Server Graphical Shell (Full Shell and min Shell),
- 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. If you were to use DISM.EXE commands to remove .Net Feature, you may not even see such a list. If you were to use PowerShell to remove .Net feature using the following command, you will not get the list.
Uninstall-WindowsFeature Net-Framework-45-Features
If you were to use Remove-WindowsFeature PowerShell cmdlet, you can add the –whatifswitch to see the list of features that would also be impacted.
Remove-WindowsFeature Net-Framework-45-Features –WhatIf
Unfortunately, we all get in a hurry sometimes and we do not read through the list and click “Remove Features”. If you notice – the “Server Graphical Shell” and “Graphical Management Tools and Infrastructure” are part of the features being removed.
Here is a sample output from running Remove-WindowsFeature Net-Framework-45-Features -WhatIf. Again you will see that removing .Net Framework will effectively also remove the following:
The two key features that I wanted to point out are:
[User Interfaces and Infrastructure] Server Graphical Shell
[User Interfaces and Infrastructure] User Interfaces and Infrastructure
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:
DISM.exe /online /enable-feature / all featurename:NetFx4
DISM.exe /online /enable-feature /all featurename:MicrosoftWindowsPowerShell
The above commands will re-install .Net 4.0 and PowerShell on the server. Once PowerShell is installed, you can add the Graphical Shell (Windows Explorer) using the following command:
Path to Powershell.
C:\Windows\System32\WindowsPowerShell\v1.0
Install-WindowsFeature Server-Gui-Shell, Server-Gui-Mgmt-Infra
Once the GUI Shell is installed, you will need to restart the server with the following command:
Restart-Computer
NOTE:
Remove-WindowsFeature and Uninstall-WindowsFeature are aliases. The -whatif command shows what would occur if the command was run but does not execute the command..
We hope this information was helpful.