One of the most common PowerShell questions we get asked is how to encrypt the Microsoft Online Admin credentials in scripts.  What people want to do is create scripts for others to run, such as their helpdesk, without letting them know the Admin password.

This request isn’t specific to Microsoft Online, and the folks over at, have several scripts which deal with this issue. The script that we’ve basically repackage can be found here.

There is lots of great information in that post, but it should be noted the password really isn’t encrypted, it’s obfuscated.  So it is possible to figure out the password from the encoded information, this makes it difficult for the average admin.

What we’ve done is create a little GUI for the script shown below

MessageOps Password Obfuscator

When you run the script, just enter the Admin UserName and Password and Click the Generate Credential Information.  You then copy all the information generated to your script.  The $adminCredential variable will contain the Credentials that you can then use throughout the script.  As you can see, most people probably won’t be able to determine the Password by looking at the information or know how to go about decoding it.

The script is available for download right here. It’s called Password Obfuscator.

As always let us know if you have any questions or comments.

Was this article helpful?