Converting a Password to Secure String


Windows_PowerShell_icon

I forget this every time I reset my password…

(Get-Credential).Password | ConvertFrom-SecureString | Out-File “C:\Scripts\365SecureString.txt”

Using it:

$pass = cat “C:\Scripts\365securestring.txt” | convertto-securestring
$mycred_online = new-object -typename System.Management.Automation.PSCredential -argumentlist “UserAccount@contoso.com”,$pass
$mycred = new-object -typename System.Management.Automation.PSCredential -argumentlist “UserAccount”,$pass

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s