I want to decode the password from a System.Security.SecureString to a readable password.
$password = convertto-securestring \"TestPassword\" -asplaintext -f
The details are explained http://blogs.msdn.com/b/besidethepoint/archive/2010/09/21/decrypt-secure-strings-in-powershell.aspx
and I have yet another slightly different way of doing it.
$pass=convertto-securestring "P@ssw0rd" -asplaintext -force | ConvertFrom-SecureString
[Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR( (ConvertTo-SecureString $pass) ))
P@ssw0rd