July 22nd, 2014

PowerTip: Convert Plain Text to Secure String

Doctor Scripto
Scripter

Summary: Learn to convert a plain text password to a secure string for cmdlet parameters.

 Hey, Scripting Guy! Question I'm trying to convert some scripts to work with the Active Directory modules, 
           but they need a secure string for the password. How do I create one of these?

Hey, Scripting Guy! Answer Use the ConvertTo-SecureString cmdlet, capture the output, then
           supply the new variable as SecureString for the password:

$SecurePassword=ConvertTo-SecureString 'MySuperSecretP@ssw0rd!' –asplaintext –force 

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.