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!