Email this to a friend
 

By default, it is not possible to specify passwords (the SecureString type) directly as a plain-text cmdlet parameter because it is unsecure to do so (and they are right). But sometimes, there's no other way to run a cmdlet without specifying the password as plain text as a cmdlet parameter. Luckily, there's an easy workaround by performing a conversion from plain text and store the password in a SecureString object.

$pw = ConvertTo-SecureString -String "your-pw" -AsPlainText -Force

You can then use the $pw object to specify the password in a cmdlet.

For example: resetting the password of an AD account:

Set-ADAccountPassword -Identity my-account -NewPassword $pw

Send a link to this post to yourself or a friend.

Send to e-mail:
Your name:
Your e-mail:
Captcha:
Type the letters and numbers as shown.
/get/captcha/1711720591
Not readable? Get another.
 
Information entered is solely used for sending a one-time e-mail, and is not retained and/or passed on to a third party.
 
 
 
 
« March 2024»
SunMonTueWedThuFriSat
     12
3456789
10111213141516
17181920212223
24252627282930
31      
 
Links
 
Quote
« I needed a password with eight characters so I picked Snow White and the Seven Dwarves. »