Skip to content

Instantly share code, notes, and snippets.

@JeremyTBradshaw
JeremyTBradshaw / ConvertFrom-SecureStringToPlainText.ps1
Last active May 14, 2025 04:29
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