In most scenarios it's enough to use the PowerShell script as is.
But
- sometimes there is some sensitive data in the script you don't want to expose
- the executable is run hidden (doesn't show the script on the screen while logging in)
To turn a PowerShell script into an Executable
- Open a PowerShell window (in Administrator mode)
- Run
Install-Module ps2exe
- 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