Skip to content

Instantly share code, notes, and snippets.

@45413
Created June 11, 2019 02:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 45413/a7dee1c67b914ba941f29502a824a002 to your computer and use it in GitHub Desktop.
Save 45413/a7dee1c67b914ba941f29502a824a002 to your computer and use it in GitHub Desktop.
Convert SecureString to String
function Convert-SecureString {
[CmdletBinding()]
param (
# SecureString
[Parameter(Mandatory=$true)]
[SecureString]
$SecureString
)
Return ( [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecureString)) )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment