This project is read-only.

Is it possible to encrypt a "modul"?

May 2, 2013 at 2:06 PM

I want crypt a PowerShell script that included some functions which I would like to protect. Is it possible to encrypt the script and then load this functions from a other .ps1 to use this functions?

Import-Module "$currentPath\Initialize.exe"

May 2, 2013 at 2:56 PM

This is not possible, because PS2EXE uses an own PowerShell environment that only exist while running the generated EXE file.

To achieve your goal you could "encrypt" you initialization script with several methods like Base64. But this is no real encryption! A power user would be able to "decrypt" it. PowerShell is not a good choice if you need to secure or protect your scripts / functions.

Hope this helps
May 2, 2013 at 3:48 PM
Edited May 2, 2013 at 3:49 PM
Hi Ingo,

Thanks for answer.
I've now a workaround, that works for me :-)

I create a Test1.ps1 with my function and a Test2.ps2 where i can call the functions:

Function TestFunction {
write-host "Very cool"

. "C:\Temp\PS2EXE-v0.4.0.0\Test2.ps1"


Now i can encrypt the Test1.ps1 und run the EXE.
Functions are loaded and then run the Test2.ps1 where i can call my function :-)