Archive for category Password

Convert string to secure phrase using PowerShell

Incoding:

$SecurePhrase=ConvertTo-SecureString “Passw0rd1” –AsPlaintext –Force

Decoding:

==================================================================================

Function
ConvertTo-PlainText( [security.securestring]$secure )

{

    $marshal = [Runtime.InteropServices.Marshal]

    $marshal::PtrToStringAuto( $marshal::SecureStringToBSTR($secure) )

}

$passwordInClearText= ConvertTo-PlainText($SecurePhrase)

Leave a comment