Can my PowerGUI compiled PowerShell script be viewed by users?

Sreehari Babu picture Sreehari Babu · Mar 20, 2015 · Viewed 9.5k times · Source

I use PowerGUI to convert my PowerShell scripts to executables, and it is working fine.

I'd like to prevent my compiled script from being extracted or decompiled by users I distribute the generated executable to.

Is it possible to view my PowerShell script inside the generated executable? If so, how do I prevent this?

Answer

Kev picture Kev · Mar 20, 2015

Unfortunately with PowerGUI it's not possible to prevent users of your executable from viewing your script, even if you use the "Protect script source code with a password" option.

The executable that PowerGUI generates is a self extracting ZIP file so it's possible to use 7-zip or WinRAR to open this file and view the original PowerShell script.

If you set a password using the "Protect script source code with a password" option all this does is password protect the files inside the ZIP container. However when launching the generated executable you'll be prompted for said password which can then be used to access the original script.