CmdID / PowerShell / Cmdlets / ConvertFrom
ConvertFrom-SecureString
Converts a secure string to an encrypted standard string. PowerShell reference
From the PowerShell reference 3 parameters
What it does
Converts a secure string to an encrypted standard string. The ConvertFrom-SecureString cmdlet converts a secure string (System.Security.SecureString) into an encrypted standard string (System.String). Unlike a secure string, an encrypted standard string can be saved in a file for later use. The encrypted standard string can be converted back to its secure string format by using the ConvertTo-SecureString cmdlet. If an encryption key is specified by using the Key or SecureKey parameters, the Advanced Encryption Standard (AES) encryption algorithm is used. The specified key must have a length of 128, 192, or 256 bits because those are the key lengths supported by the AES encryption algorithm. If no key is specified, the Windows Data Protection API (DPAPI) is used to encrypt the standard string representation. NOTE: For more information about SecureString data protection, see How secure is SecureString?.
ConvertFrom-SecureString [-SecureString] <SecureString> [[-SecureKey] <SecureString>] [<CommonParameters>]ConvertFrom-SecureString [-SecureString] <SecureString> [-Key <Byte[]>] [<CommonParameters>]
Create a secure string
$SecureString = Read-Host -AsSecureStringIdentifyConvert a secure string to an encrypted standard string
$StandardString = ConvertFrom-SecureString $SecureStringIdentifyConvert a secure string to an encrypted standard string with a 192-bit key
$Key = (3,4,2,3,56,34,254,222,1,1,2,23,42,54,33,233,1,34,2,7,6,5,35,43)
$StandardString = ConvertFrom-SecureString $SecureString -Key $KeyIdentifyIts page in the reference: ConvertFrom-SecureString.
Parameters
-KeySpecifies the encryption key as a byte array. If the key doesn't match the key used to encrypt the original secure string, the value returned is invalid. If the encrypted string was created without a key, you shouldn't use a key to convert it back to a secure string.-SecureKeySpecifies the encryption key as a secure string. The secure string value is converted to a byte array before being used as the key. If the key doesn't match the key used to encrypt the original secure string, the value returned is invalid. If the encrypted string was created without a key, you shouldn't use a key to convert it back to a secure string.-SecureStringSpecifies the secure string to convert to an encrypted standard string.