PowerShell running in Dotnet 4

June 26th, 2010 by Karl

Back in the Dotnet 4, VS.NET 2010 Beta days i threw together a PowerShell console host compiled against dotnet 4 but really didn’t do anything with it. It seems that there is a bit of demand for it. So here it is. You canĀ download it and start using it.

It at least allows you to interact with dotnet 4 code in-process. Its not going to turn PowerShell into a dotnet 4.0 citizen as really PowerShell is in what I call “Dotnet 1.9″ style. Its going to be very awkward to interact with Dotnet 4 dynamic objects without some nice helpers but at least it IS possible.

Also I very much doubt that this will be able to be used as a remoting server. However you could have a dotnet 2, PS V2 runspace call this to do some processing. Tedious but at least possible.
Background jobs also aren’t going to run in Dotnet 4, though they possibly may if you manage to rename the original powershell.exe and put this one in its place. I know on windows 7 the ability to do is locked down, but it might be possible on other OSes.

All Command line options should work other than Console files.

Download NOW!!!

Notice the CLR version above?

Download NOW!!!

Just download it, and if with IE make sure you “unblock” the zip, then unzip it and run it anywhere you have PowerShell V2 installed. Enjoy.

Thanks to @jstangroome on twitter to helping motivate me get this out.

Karl Prosser / ShellTools LLC.

Posted in Powershell | 4 Comments »

4 Responses

  1. The Morning Brew - Chris Alcock » The Morning Brew #630 Says:

    [...] PowerShell running in Dotnet 4 – Karl Prosser shares a version of the PowerShell console running against .NET 4 . This allows Powershell to interact with code compiled against the .NET 4 CLR in the same process. [...]

  2. Running Inline C# with Custom Assemblies in PowerShell 2.0 Says:

    [...] now the custom assemblies are referenced correctly your C# code should be added correctly to you PowerShell session and you can start using the methods. My example here does use .NET 4.0, and because the standard PowerShell console doesn’t support .NET 4.0 I used a custom console which you can get here: [...]

  3. Baljinder Says:

    Any chance you can post the source?

  4. Karl Says:

    I’ll put it in github projet soon.

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.