PS1ToEXE module: Convert your PowerShell project to an EXE


In this post, I will show you a quick module I created that allows you to create an EXE from a PowerShell project.
This allows you to run a PS1 file from an EXE, add an icon, and also a password.

Prerequisites
For now the EXE file is an SFX archive build with WinRAR meaning Winrar is required.
Even if WinRar prompts you for a licence, it's not mandatory, you can still use it :-)

Known issue
Your EXE may be considered as a Trojan by your antivirus.
In fact, it's false positive report.
See below some articles about this subject:
https://thesunstroke.blogspot.com/2017/11/false-antivirus-reports-on-installers.html
https://www.virusbulletin.com/virusbulletin/2005/11/false-positive-disaster-anti-virus-vs-winrar-amp-co/

How to get the module ?
The module PS1ToEXE is available in the PowerShell Gallery.
To intall it type install-module ps1toexe, as below:


How to use it ?
The module contains one commandlet, called EXE, as you can see below.

See below how to use it:

Module in action

Example 1
- My EXE name is BIOS Checker.exe
- This one is located in the folder tool.
- The main ps1 is BIOS_Checker.ps1

See below the module in action:

See below the result

Example 2
- My EXE name is BIOS Checker.exe
- This one is located in the folder tool.
- I want to add an icon.
- The main ps1 is BIOS_Checker.ps1

See below the module in action

Example 3
- My EXE name is BIOS Checker.exe
- This one is located in the folder tool.
- I want to add an icon.
- I wan to add an password to run the EXE.
- The main ps1 is BIOS_Checker.ps1

See below the module in action

What's next ?
In the next version, I will add other ways than WinRAR to build the EXE like 7Zip, nsis and some C# libraries.
You will then be able to choose the way you want to proceed.

Share this

Related Posts

Previous
Next Post »