There are two methods for this:
PS2EXE module
Install-Module -Name PS2EXE under PowerShell then to compile:
- ps2exe .\myScript.ps1 .\myApp.exe
IExpress, this works if you are in locked-down system and can't install PS modules.
Win+R, type "iexpress"- Select "Create new Self Extraction Directive file" , then "Extract files and run an installation command"
- Package your .ps1 script, and any accompanying asset files
- For the installation command, tell it to invoke PowerShell while bypassing local restriction policies:
"powershell.exe -ExecutionPolicy Bypass -File myScript.ps1"
Have fun :)