Removing .NET Framework 4.5/4.5.1 removes Windows 2012/2012R2 UI and other features
This is Vimal Shekar and Krishnan Ayyer from the Windows Support team. Today in this blog, we will be discussing about an issue that we are seeing increasingly being reported in support. We will look at the effects of removing .Net Framework from a Windows Server 2012/2012 R2 installation.
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 –whatif switch 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:
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.
Vimal Shekar
Escalation Engineer
Microsoft Support
Krishnan S Ayyer
Technical Advisor
Microsoft Support
Comments
- Anonymous
January 01, 2003
Nice Blog...Thanks so much... - Anonymous
January 01, 2003
The comment has been removed - Anonymous
January 01, 2003
Thanks everyone, glad that it helped a few of you avoid rebuilds. Also thanks for pointing out the error in the cmdlet, we have updated that. - Anonymous
January 01, 2003
The DISM commands have been fixed in the blog now. Thanks everyone for bringing it to our attention - Anonymous
January 01, 2003
@Jack : Removing .NET 4.0 from client, doesn't affect it because the package dependencies are different on a client. Client OSes don't have a server-core like mode. - Anonymous
January 01, 2003
@Hayden :
If the machine has booted up without any UI, then the easiest thing to do is to use Ctrl+Alt+Esc to launch the task manager.
From there use File > New Task and type in cmd.exe or powershell.exe.
Then run the commands. If you launched cmd.exe, run the dism commands. If you chose powershell.exe, then run the Install-WindowsFeature commands from the blog - Anonymous
April 28, 2014
A very good article, indeed! Thank you. - Anonymous
April 30, 2014
227 Microsoft Team blogs searched, 40 blogs have new articles. 113 new articles found searching from - Anonymous
May 05, 2014
Great Information !!! - Anonymous
May 06, 2014
What if the commands to reinstall the Framework doesn't work? - Anonymous
May 12, 2014
I cannot get the command to install .net 4.0 to work either. - Anonymous
May 12, 2014
Figured it out, you must type it as:
DISM.exe /online /enable-feature /featurename:NetFx4 /all
Then, it will work. - Anonymous
May 15, 2014
I believe if you check you'll find RSAT is "Remote Server Administration Toolkit" (10,000 matches in google for that exact string) and not "Remote Administration Assessment Toolkit" (8 matches). - Anonymous
June 05, 2014
Very useful!!!
Couple of typos as spotted by others, but that said it saved having to do a rebuild when application installer removed dotNet 4.5!!! - Anonymous
June 13, 2014
anyhow can
DISM.exe /online /enable-feature /all /featurename:NetFx4 - Anonymous
June 17, 2014
Path to Powershell.
C:WindowsSystem32WindowsPowerShellv1.0
Also if you do what I did and close the dos window, you can restart the server from another server by running the following from a remote server. This will bring the dos window back.
Restart-Computer -ComputerName [ServerName] -Force - Anonymous
June 18, 2014
hello,
DISM.exe /Online /Enable-Feature /Featurename:NetFx4 /All
DISM.exe /Online /Enable-Feature /Featurename:MicrosoftWindowsPowerShell /All
from cmd, type: start powershell (to launch PS)
enter the following command;
Install-WindowsFeature Server-Gui-Shell
Install-WindowsFeature Server-GuiMgmt-Infra - Anonymous
June 29, 2014
Thanks. Simple and Meaningful - Anonymous
July 17, 2014
Its really Great Information .
se below syntax of command.
DISM.exe /online /enable-feature / all /featurename:NetFx4
DISM.exe /online /enable-feature /all /featurename:MicrosoftWindowsPowerShell - Anonymous
July 23, 2014
Great blog. Verry helpful. Thank you - Anonymous
July 23, 2014
Great blog. Very helpful. Thank you - Anonymous
August 01, 2014
Great Job ! Very useful - Anonymous
August 05, 2014
Hello,
I have done this very mistake mentioned in this article. However I do not get the command prompt when I reload server 2012.
I can get to command prompt via an installation disk, but I cannot modify the system image from there. How do I access the system image? Where is the system image / this server is a physical server.
/Image: << Do I use that command, where is it? - Anonymous
September 02, 2014
Excellent article, good explanation. - Anonymous
September 03, 2014
This is easy task like uninstalling any software from computer. Open programs and features from the control panel and select the .net framework for uninstall. Inhttp://www.sagacademy.com/dotnet-development-training-jaipur">Dot Net Development this is very important term. - Anonymous
September 08, 2014
Nice article... much needed. - Anonymous
September 13, 2014
The comment has been removed - Anonymous
September 15, 2014
Great Article, saved me having to re-image. - Anonymous
October 16, 2014
What If I am Not Running a Server, and It is installed? - Anonymous
October 27, 2014
Thanks so much, you save me lots of headache...Exaclly what I needed - Anonymous
October 31, 2014
Thank you so much! - Anonymous
November 12, 2014
Hi Sir,
Its a nice blog .. It helped me a lot and saved me ...
Thanks to these commands :
DISM.exe /online /enable-feature /all /featurename:NetFx4
DISM.exe /online /enable-feature /all /featurename:MicrosoftWindowsPowerShell
:) - Anonymous
November 14, 2014
Thank you! You saved my day. - Anonymous
December 10, 2014
Excellent article! Thank you for this information - Anonymous
December 30, 2014
Well Done. Great job. - Anonymous
January 02, 2015
Useful , congratulation ;-) - Anonymous
January 28, 2015
The comment has been removed - Anonymous
January 28, 2015
Thanks. Good info. - Anonymous
January 30, 2015
lovely article, thanks so much!
sadly, my machine is not directly connected to internet, so I have to figure that out before the Netfx4 install will work. - Anonymous
February 02, 2015
The comment has been removed - Anonymous
February 03, 2015
This article saved me a big time. Thank you. - Anonymous
February 05, 2015
Thanks Man, you really saved my day. It's great article. - Anonymous
February 10, 2015
Thanks John,
You are life saver.... Great post... - Anonymous
February 22, 2015
Thanks - Anonymous
February 25, 2015
awesome - Anonymous
February 27, 2015
how do i go about to uninstall .net framework 4.5? - Anonymous
March 17, 2015
My precious... - Anonymous
March 19, 2015
Thank you.
You have just saved my day.
The only thing that is missing is the path to Powershell.exe, which have to be executed before the Install-Windowsfeature command can be run. - Anonymous
March 26, 2015
You saved the day for me! - Anonymous
March 27, 2015
Worked like a charm...many thanks - Anonymous
April 12, 2015
Informative - Anonymous
April 15, 2015
This article saved my day. Thank you so much. - Anonymous
April 30, 2015
Nice blog....thanks boss - Anonymous
July 07, 2015
Fantastic !, resolved my server manager not able to open issue, but would like to know where it went wrong, i.e. 2012 we should not implment the default .Net 4.5? or we should not use the any update for lower versions of the .Net ? we are using the image to build the server we need to know how to stop for future issues. Appreciate your resoponse. Thanks in advance - Anonymous
July 17, 2015
Awesome!
Thanks John & lawal niyi! - Anonymous
July 28, 2015
This information was really helpful:) - Anonymous
August 14, 2015
Thank you so much! This was excellent and easy to follow guide. I did have to do a restart of the machine after installing NetFX4 and Powershell before I could actually bring up the PowerShell prompt. Other than that one hiccup, it worked flawlessly. - Anonymous
August 24, 2015
Great article! Saved me a lot of time and worry.
Thank you. - Anonymous
September 03, 2015
Thank you. - Anonymous
September 08, 2015
Thank you so much! - Anonymous
September 13, 2015
Glad to have found this. One of the things that I thought was going to be nice about .NET 5 Core was that .NET apps using the Core CLR runtime wouldn't need .NET on the server. I was hoping to have WS2012R2 web servers without .NET 4.x. However, this blog post makes it very clear that so much of the OS depends on .NET 4.x that we won't be able to remove the framework as I had hoped. - Anonymous
September 15, 2015
Thanks guys - you saved my day. - Anonymous
September 25, 2015
Most Excellent - Anonymous
October 05, 2015
Thank you .. it worked .... - Anonymous
October 12, 2015
Thank YOU that solved the problem :) - Anonymous
November 12, 2015
Thanks for the great article guys. It saved my bacon in a time of need. Good job on the documentation! - Anonymous
November 25, 2015
I navigated to C:WindowsSystem32WindowsPowerShell and the folder was empty. I thought it was working but it looked like it was working. So i just did cd v1.0 and it worked, the folder is hidden for some reason. - Anonymous
December 11, 2015
Useful stuff. This helped me.. neatly written... - Anonymous
December 15, 2015
Thank you so much - Anonymous
January 19, 2016
Thank you. I wish that I had read this yesterday. - Anonymous
February 02, 2016
Very helpful. - Anonymous
February 04, 2016
The comment has been removed - Anonymous
February 07, 2016
Good blog !It worked !!!! - Anonymous
February 24, 2016
Great information! You saved the day! Thanks!!! - Anonymous
March 14, 2016
The comment has been removed - Anonymous
April 23, 2016
Thank you so much. - Anonymous
April 26, 2016
Nice Blog , thanks so much i had this problem today and i try these 2 command and it's workDISM.exe /online /enable-feature /all /featurename:NetFx4DISM.exe /online /enable-feature /all /featurename:MicrosoftWindowsPowerShell - Anonymous
April 29, 2016
The comment has been removed - Anonymous
June 09, 2016
We've experienced this situation, but with a twist. Everything is as described, but after running the commands, the GUI shell fails to fully install. Install-Feature command works, but after reboot, rolls back due to unspecified failure. Is there a way to find out what feature install failure is due to? Only relevant thing I see in CBS log isHRESULT = 0x800f0921 - CBS_E_PRIMITIVES_FAILED - Anonymous
November 02, 2016
for one software i need .net framework 3.5 in windows server 2012 it is already installed but problem is that its not fully installed may be some files was missing because when i m trying to installing my new s/w he is asking that .net 3.5 framework -->"required files are missing or damaged." so what i need to do for further..- Anonymous
November 02, 2016
error code 0x80004005 was generated while removing the .net framework 3.5 feature.
- Anonymous
- Anonymous
November 15, 2016
The comment has been removed - Anonymous
November 15, 2016
Thanks a TON. I had uninstalled .NET frameworks in order to reinstall them and freaked out when I couldn't access the VPS again. Your article saved me. Thanks a lot for this. - Anonymous
December 12, 2016
Saved my day.. Thank you very much! - Anonymous
January 06, 2017
The comment has been removed - Anonymous
February 13, 2017
Very useful, one thing to note you should reboot AFTER installing PS then continue onto the GUI installs. But again, this was VERY helpful when running into the sane situations! - Anonymous
February 22, 2017
The comment has been removed - Anonymous
July 11, 2017
Brilliant. Had a .NET issue and needed to reinstall it. This was easy. Just remember to bring up Task Manager and run "powershell" to get PowerShell going for the other PowerShell newbies. - Anonymous
July 18, 2017
I have managed to run the "install-windowsFeature..." part in Powershell but it just sits around 24%. I suppose "have some patience" is key and it will get to 25%--100%. Is this normal?- Anonymous
July 18, 2017
It seems like you need to have faith and it will eventually get to 92% and 100% - give it a few minutes (10+). Above instructions should include that the last 2 instructions need to be run from Powershell
- Anonymous
- Anonymous
July 20, 2017
Thank you....! It worked..... :) - Anonymous
March 18, 2019
A very good article, indeed! Thank you.