Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
For PowerShell 5.1 and older, convert secure strings back to plain text
function ConvertFrom-SecureStringToPlainText ([System.Security.SecureString]$SecureString) {
[System.Runtime.InteropServices.Marshal]::PtrToStringAuto(
[System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString)
)
}
New-Alias -Name s2p -Value ConvertFrom-SecureStringToPlainText
@JeremyTBradshaw
Copy link
Author

JeremyTBradshaw commented Sep 4, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment