Using CPAU to execute scripts as Administrator hiding credentials

Ocasionally we need to execute orders or scripts as Administrator, and “runas” is not a valid option because users can read the script and find a super user password (No way). In this cases we can try with CPAU, with this free tool we can generate an scripted job that can be called from script secure. The job contains de execution command and the dessired credentials. Let’s prepare an example.

First of all we need to download from it’s webpage after decompressing we wil get a CPAN.exe ready to use.

In this simple exercice we’ll see how to create an encrypted job and then execute.

Step 1 Generate a job

cpau -u domain\user -p password -ex "script" -enc -file filename.job


cpau -u ACME\Administrator -p MyPassword -ex "AddRegedit.cmd" -enc -file registerSome.job

This command will generate an encrypted file named registerSome.job, we can try to read this file en we will see some thing like this:


Step 2 call CPAU job

cpau -dec -file registerSome.job -lwp

Hope this can help you

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.