Forked from JeremyTBradshaw/ConvertFrom-SecureStringToPlainText.ps1
Created
November 5, 2024 14:23
-
-
Save cmsp-marufe/9267eefc818660f34d220f862a6a1e62 to your computer and use it in GitHub Desktop.
For PowerShell 5.1 and older, convert secure strings back to plain text
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function ConvertFrom-SecureStringToPlainText ([System.Security.SecureString]$SecureString) { | |
| [System.Runtime.InteropServices.Marshal]::PtrToStringAuto( | |
| [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString) | |
| ) | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am using this particular function in a PowerShell Module, and re-importing the module for testing causes the 'alias' command in Jeremy's version to throw an error on each subsequent run, so I removed that last line from my fork here.