Skip to content

Instantly share code, notes, and snippets.

@yordanoweb
Created October 13, 2025 20:02
Show Gist options
  • Save yordanoweb/0bfef2d561822ed6e3bf4467d50c28cf to your computer and use it in GitHub Desktop.
Save yordanoweb/0bfef2d561822ed6e3bf4467d50c28cf to your computer and use it in GitHub Desktop.
Secure password to variable in PowerShell

Enter secure password to variable in PowerShell

$plainText = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($(Read-Host -AsSecureString)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment