Quantcast
Channel: Greg – code.commongroove.com
Viewing all articles
Browse latest Browse all 30

PowerShell: Read Secure String and Convert Back to Plain Text

$
0
0

Here’s a quick way to read in a secure string and then convert it back to plain text:

$SecureString = Read-Host -Prompt "What is the secret?" -AsSecureString
$ClearTextString = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString))

Also, take a look at the ConvertTo-SecureString and ConvertFrom-SecureString functions of PowerShell.

Hope this helps!


Viewing all articles
Browse latest Browse all 30

Trending Articles