Skip to main content desktop
Try Now

PowerShell: Running .NET 4 with PowerShell Version 2.0

Kris PowellKris Powell

Let me start by saying that I am as excited as the next person to try new technology and upgrade all my software. Unfortunately, we cannot always upgrade the hardware/software in our production environments due to a variety of factors.If you are able to upgrade your version of PowerShell to the latest and greatest, then please upgrade to the latest and greatest version. This blog post is for a (hopefully) small percentage of people who may find themselves stuck with an older version of PowerShell while needing to leverage something in a newer version of .NET Framework.

Running .NET 4 with PowerShell 2.0

There are two ways to tell PowerShell version 2.0 to utilize .NET Framework 4.You can modify for all .NET applications or just for PowerShell itself. I cannot think of many situations where I’d want to force this setting globally for all .NET applications, so we’re going to address it just for PowerShell via some configuration files. All we need to do is create those configuration files and place them into their appropriate locations.You’ll want to create




and place them in your $pshome directory.

Here is what you want in both of those .config files:

<xml version= encoding=?>
<supportedRuntime version= />
<supportedRuntime version= />

Here is the location of $pshome by default:

32-bit machines: C:\Windows\System32\WindowsPowershell\v1.0

64-bit machines 32-bit version: C:\Windows\SysWOW64\WindowsPowershell\v1.0 64-vit version: C:\Windows\System32\WindowsPowershell\v1.0

The quick and easy way to overwrite those files and place them where they need to be would be to run this as a script.We place the entire content of the xml file into a variable via what’s known as a here-string. They let us use multi-line strings very easily. We output the new variable directly to two new files (overwriting existing files, so be careful).


| \powershell_ise.exe.config
| \powershell.exe.config

Voila! Like magic, the new files are created. Simply restart your PowerShell console and you should be able verify which .NET CLR Powershell is using by using $PSVersionTable. We’re looking for the CLRVersion value, which is 4.0.30319.18444 in my case. That tells me I’m using .NET 4.

Hopefully you never find yourself in a position where you’re limited with your PowerShell versions. But, if you ever do find yourself in such a pickle, hopefully this can point you in the right direction.

Ready to get started with PDQ Deploy & Inventory? Work less, automate more.

Start your 14-day free trial
Sign up in seconds

Don't miss the next post!

8 ways to protect your business from ransomware

Ransomware attacks are on the rise, and it's only a matter of time before your business becomes a target. Learn how to protect yourself before it's too late.

© 2021 Corporation
  • PDQ Deploy ®
  • PDQ Inventory ®
  • SimpleMDM
  • Pricing
  • Downloads
  • Licensing
  • Buy