Vai al contenuto

How to turn a PowerShell script into an executable

n most scenarios it’s enough to use the PowerShell script as is.

But

  1. sometimes there is some sensitive data in the script you don’t want to expose
  2. the executable is run hidden (doesn’t show the script on the screen while logging in)

To turn a PowerShell script into an Executable

  1. Open a PowerShell window (in Administrator mode)
  2. Run
Install-Module ps2exe

3. Run

Invoke-PS2EXE C:\ProgramData\Cameyo\StartupBefore.ps1 C:\ProgramData\Cameyo\StartupBefore.exe

In the case of a startup script, don’t forget to remove the PowerShell script, otherwise the script will be executed twice

to add an icon ….

Invoke-PS2EXE .\StartleScript.ps1 StartleScript.exe -iconFile C:\Users\jfargion-admin\Downloads\erbc.ico
Invoke-PS2EXE .\StartleScript_noconsole.ps1 StartleScript.exe -iconFile C:\Users\jfargion-admin\Downloads\erbc.ico -noconsole -company 'ERBC-Group' -version '1.0' -noOutput -title 'ES0203 - Startle Script Tool' -copyright 'ERBC-Group by Jacques Fargion' -exitOnCancel

Ref: https://github.com/MScholtes/PS2EXE

Lascia un commento

Il tuo indirizzo email non sarĂ  pubblicato. I campi obbligatori sono contrassegnati *