Convert PowerShell (.ps1) to an Executable (.exe)
When we create PowerShell Scripts or Graphical User Interfaces (GUIs) there are different ways to execute the script. We could right click the file and choose “Run with PowerShell”, or we could doubleclick it as an executable. This makes it easy to find and quicker to launch from the start menu. Just press (Windows key, type the name of the tool, and press Enter) …et voila!
One of the best methods for your toolbox is to convert a .ps1 file to .exe
Good thing we get to stand on the shoulder’s of giants. PS2EXE is simple as it is useful. It can be found from a GitHub repository: https://github.com/MScholtes/PS2EXE
Here’s how we install it and turn a script into an app.

- Select the Code Dropdown button and Download the ZIP
- Unzip the file
- Open a PowerShell Admin console

INSTALL THE PS2EXE MODULE
Type the following command into PowerShell:
PS C:\> Install-Module -Name PS2EXEGreat job!
SET EXECUTION POLICY, IMPORT, and INVOKE PS2EXE
Now we need to run the Invoke-PS2EXE command to convert it into an executable, but the probability that this will run without a hitch is low until we import the ps2exe module.
I’m sure some of you are saying, “What is this gibberish?! Import the what in the where for what to do huh!?”
Basically, our worst case scenario is that we will have three roadblocks. The first one is to invoke PS2EXE, but we can’t do this until we import PS2EXE. And we cannot import until we set the execution policy to the correct setting. Simple, right? It’s actually easier than it might seem.
Let’s do a recap:
- Invoke
- Import
- Set the Execution Policy
But in order for the issue to be resolved, we will need to face these obstacles in reverse order: 3, 2, 1.
ENSURE THE EXECUTION POLICY IS SET TO UNRESTRICTED
Unless you like playing with fire, the odds are that your execution policy is set to something other than ‘Unrestricted’. It might be something like Allsigned, Default, RemoteSigned, or Restricted. Whatever it is, it’s best to check by typing the following:
PS C:\> Get-ExecutionPolicyRemember this; we will revert back to it when we’re done.

In my example it’s set to Restricted. Yours might say Allsigned, Default, Bypass, or something else. In order to convert your script into an executable, we will need to change your Execution Policy to Unrestricted. Trusting this GitHub source is necessary to move forward to convert your .ps1 to an executable. Disclaimer: I cannot be held liable if anything malicious happens to your computer. Just remember that we will be changing it to your original settings when we’re done.
Let’s type the following:
PS C:\> Set-ExecutionPolicy UnrestrictedFollow this command with Importing and Invoking in the next sections.
IMPORT PS2EXE
After the Execution Policy is set to allow anything to be imported, we’ll type the following:
PS C:\> Import-Module ps2exeAwesome! Now, let’s move quickly.
INVOKE PS2EXE
Make sure that this next command includes the location AND name of the existing .ps1 file if you are not working in the same directory. Go ahead and type the following:
PS C:\> Invoke-PS2EXE -InputFile NameOfYourScript.ps1 -OutputFile NameOfYourExecutable.exeAs a kicker, if you’re launching a PowerShell GUI, then we can hide the console while the GUI launches. Just add-noConsole to the end of the Invoke-PS2EXE line like this:
PS C:\> Invoke-PS2EXE -InputFile NameOfYourScript.ps1 -OutputFile NameOfYourExecutable.exe -noConsoleFINAL STEPS
Don’t forget to change the Execution Policy back to your initial settings. Type the following and add Allsigned, Restricted, or whatever it was set to at the end. See the below example:
PS C:\> Set-ExecutionPolicy RestrictedCONCLUSION
Look in the folder you saved the executable, double-click to execute, or add it to your favorite stick. Cheers!
I urge you to take heed of the PS2EXE README and, **Please do not use PS2EXE to create harmful programs!**





