PowerShell: Version v4.0.30319 of the .NET Framework is not installed

When you open Windows Terminal (PowerShell), the following error may occur:

Version v4.0.30319 of the .NET Framework is not installed and it is required to run version 3 of Windows PowerShell.

If you run PowerShell.exe, the window may close immediately.

Running the .NET Framework Repair tool or removing and reinstalling .NET Framework may not resolve the error.

Cause

The above error occurs due to the missing InstallRoot registry value in one or both of the following keys:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework

Resolution

To resolve the PowerShell error, please create the missing values in the registry.

Option 1: Use the REG file to restore the missing values

To restore the InstallRoot registry value, download and run netfx_installroot_fix.reg (zipped)



Unzip and run the enclosed REG file.

Click Yes to confirm.


Option 2: Create the values manually

  1. Launch Regedit.exe and go to:
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework
  2. In the right pane, create a new string value (REG_SZ) named InstallRoot (if it doesn’t already exist.)
  3. Set the value data of InstallRoot to C:\Windows\Microsoft.NET\Framework64\
    .net installroot fix - powershell closes
  4. Next, go to the following branch:
    HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\.NETFramework
  5. In the right pane, create a new string value (REG_SZ) named InstallRoot (if it doesn’t already exist.)
  6. Set the value data of InstallRoot to C:\Windows\Microsoft.NET\Framework\
  7. Exit the Registry Editor.

Note: The 2nd location above (i.e., the WOW6432Node branch) doesn’t exist in the Windows 10/11 32-bit edition. In that case, skip the 2nd location. To determine if you’re using a 32-bit or 64-bit edition, see How to Find Your Windows 10/11 Build Number, Version, Edition, and Bitness.

That should resolve the .NET Framework “Version v4.0.30319 of the .NET Framework is not installed” error when launching Terminal/PowerShell.


One small request: If you liked this post, please share this?

One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
  • Pin it!
  • Share it to your favorite blog + Facebook, Reddit
  • Tweet it!
So thank you so much for your support. It won't take more than 10 seconds of your time. The share buttons are right below. :)

Ramesh Srinivasan is passionate about Microsoft technologies and he has been a consecutive ten-time recipient of the Microsoft Most Valuable Professional award in the Windows Shell/Desktop Experience category, from 2003 to 2012. He loves to troubleshoot and write about Windows. Ramesh founded Winhelponline.com in 2005.

Leave a Comment