Update of PS2EXE: Version Now Supports PowerShell 3.0 and 2.0!

Some time ago I’ve written a little tool called “PS2EXE” that creates .EXE files from PowerShell script files. As mentioned in earlier posts this is no conversation of PS to EXE! The PS2EXE script creates an EXE by using the C# compiler and stores the script as Base64 encoded string inside a tiny PowerShell host application.

Today I’ve updated the PS2EXE script to version Now it supports PowerShell 3.0 and PowerShell 2.0.


(Formerly: http://ps2exe.codeplex.com)

Here are the past blog articles:

There are two new parameters for PS2EXE:


-lcid <int>

Using -runtime30 or by starting PS2EXE in a PowerShell 3.0 environment PS2EXE creates a EXE file by using the C# compiler version 4.0.

Using -runtime20 or by starting PS2EXE in a PowerShell 2.0 environment PS2EXE create a EXE file by using the C# compiler 2.0.

-lcid sets the “culture” of the current thread to the specified value. (See http://msdn.microsoft.com/en-us/library/system.threading.thread.currentuiculture.aspx and http://msdn.microsoft.com/en-us/library/system.threading.thread.currentculture.aspx and http://msdn.microsoft.com/en-US/library/w4deeh00(v=vs.80).aspx and http://msdn.microsoft.com/en-us/goglobal/bb964664.aspx.)

The new version should fix the “Assembly not referenced” error discussed here:


On Windows 8 or Windows Server 2012 there is PowerShell 3.0 installed by default. On Windows 7 or Windows Server 2008 R2 you can install it using Windows Management Framework 3.0.

With PowerShell 3.0 installed you will always start the 3.0 enviroment by using:

the Start Menu (or Screen)


the “Run” dialog:


the command line:


Execution PS2EXE reports PowerShell version 3.0:


You can start a PowerShell 2.0 enviroment by using this parameter: -version 2.0 for POWERSHELL.EXE


Execution PS2EXE reports PowerShell version 2.0:


Now lets use to create an EXE file using the PS2EXE script…

1. Sample: PowerShell 3.0 without parameters –runtime20 and –runtime30


2. Sample: PowerShell 3.0 with parameter –runtime20


(Behind the scene this starts PowerShell.exe using parameter –version 2.0.)

3. Sample: PowerShell 2.0 without parameters –runtime20 and –runtime30


4. Sample: PowerShell 2.0 with parameter –runtime20


This is not supported!

PS2EXE v0.2.0.0: Improvements: Platform switch (x64 or x86 or AnyCPU), new “EXE.config” file for “supported runtime”

(Original article: https://blog.kenaro.com/2011/06/21/ps2exe-tool-for-converting-powershell-scripts-to-standalone-exe-files/)

I have implemented some new switches for PS2EXE:


This compiles the EXE to be run as 32 bit application also on 64 bit OS.


This compiles the EXE to be run as 64 bit application. Therefore an 64 bit OS ist necessary.


This creates an “.exe.config” file with this content:

      <supportedRuntime version="v2.0.50727"/>

Please read this article on MSDN http://msdn.microsoft.com/en-us/library/w4atty68.aspx

this may fix some errors that users reported to me.


You can download the new version ouf PS2EXE here: