December 21st, 2013

PowerTip: Create a Secure Password with PowerShell

Doctor Scripto
Scripter

Summary: Use Windows PowerShell to make a plain text entry into a secure password. 

Hey, Scripting Guy! Question Is there a way I can use Windows PowerShell and my working script to make a secure string password without using Read-Host?

Hey, Scripting Guy! Answer Use the ConvertTo-SecureString cmdlet:

$MyBoringPassword=”OhThisCouldBeSecure!ButEverybodyIsReadingThisOnTheInternet!”

To convert this to a SecureString, which is typically needed when you create a new user in Active Directory, execute:

$SecurePassword=CONVERTTO-SecureString –asplaintext –force –string $MyBoringPassword

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.

Feedback