Putting together EXE’s has become common practice to simplify script deployments and satisfy dependencies on client systems no matter what the programming language be it perl, python or.NET code. Packing dependencies for the script into native code you don’t have to worry about pesky dependencies. Now there is a tool to turn PowerShell scripts from EXE’s utilizing WinRAR’s self extracting executable capabilities.
The tool description is from TechNet:
“Here is a little tool in Powershell which allow you to create an EXE from your Powershell script.A self-extracting archive with Winrar will be created and your PS1 script or GUI will be launched automatically after running the exe file. “
The disclaimer is that it’s not actually native code. What’s happening is the tool is that it’s creating a self extracting sfx archive through WinRAR. When a user runs the exe you created, lets say “dosomething.exe”the self extracting rar extracts the powershell script and runs it. There are multiple reasons to do this, the most obvious is to simplify the process for users that will be confused when asked to run a powershell script. The other is that you can deploy other dependencies with the powershell script such as configuration files, .NET assemblies that the script may call as well as applying other settings that may be necessary for the script to do it’s job.
The tool is called “PS1 To EXE Generator” and can be found on the TechNet website from the link below.
https://gallery.technet.microsoft.com/PS1-To-EXE-Generator-d39e8be2
Enjoy!