Po$H Pete | Those who can… $cript
20Jan/110

Enabling .NET 4 in Your Powershell Environment

NOTE: This isn't a supported configuration and should be done carefully. Powershell is designed to be run under .NET 2, so you may experience some oddities with some of your functions/commandlets.

Now that the disclaimer is out of the way, I thought I'd share with you how I've enabled .NET 4 in my Powershell environment. It's quite straight forward:

1 - Browse to your Powershell folder under c:\windows\system32\windowspowershell\v1.0
2 - Create a text file called powershell.exe.config
3 - Enter the following XML

<?xml version="1.0"?>
<configuration>
	<startup useLegacyV2RuntimeActivationPolicy="true">
		<supportedRuntime version="v4.0.30319"/>
		<supportedRuntime version="v2.0.50727"/>
	</startup>
	<runtime>
		<loadfromremotesources enabled="true"/>
	</runtime>
 
</configuration>

4 - Save the file and start Powershell.

Admittedly, I ran my configuration like this for well over a year without any problems. The main thing that you will notice is that Powershell seems to take a lot longer to start.

Once you've done this, you'll now have all of the .NET 4 framework to play with... something that I'm going to be using in my next post.