Contact Info

Crumbtrail » Administration » Powershell » Powershell 1.0 » ConvertFrom-SecureString

ConvertFrom-SecureString - Powershell 1.0 CmdLet

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.


Convert a secure string into an encrypted standard string


        The secure string to convert to an encrypted standard string.
        The encryption key as a secure string,
        this is converted to a byte array before being used as the key.
   -key Byte
        The encryption key as a byte array.
        The common parameters: -Verbose, -Debug,-ErrorAction, -ErrorVariable, -OutVariable.

Create a secure string by typing at the command prompt.

PS C:\>$securestring = read-host -asSecureString

Convert a secure string stored in a variable to an encrypted standard string. The resulting encrypted standard string can be displayed by typing $standardstring:

$standardstring = convertfrom-securestring $securestring

Convert a secure string using the Rijndael algorithm, the key is an array of 24 digits, all of which are less than 256, (24 * 8 bit bytes = 192 bits)

PS C:\>$key = (3,42,2,3,100,34,254,222,1,1,2,23,42,54,33,233,1,64,2,7,6,5,35,43)
$standardstring = convertfrom-securestring $securestring -key $key