Private/DecryptSecureString.ps1

1
2
3
4
5
6
7
8
9
10
11
12
Set-StrictMode -Version Latest

function DecryptSecureString {
    param(
        [parameter(position=0,mandatory=$true)]
        [System.Security.SecureString]
        $SecureString
    )

    $BStr = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString)
    [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BStr)
}