Udostępnij za pośrednictwem


PowerTip: Create a Secure Password with PowerShell

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