SecureString

noun

say it: “si-KYOOR string” /sɪˈkjʊr ˌstrɪŋ/

Text that PowerShell keeps scrambled in memory, such as a password, so it doesn't show when a variable is printed.

What is a SecureString?

A SecureString holds a password scrambled in memory instead of as plain text, so it doesn't show up by accident when a variable is printed or logged. Print one and you see only System.Security.SecureString. Commands that need the password read it from the object themselves.

$password = Read-Host -Prompt 'Password' -AsSecureString
$password   # System.Security.SecureString

In a sentence

  • “The password came back as a SecureString, so printing it showed only its type name.”
  • “Read-Host -AsSecureString hands back a SecureString instead of plain text.”

Level: Freelancer · More PowerShell terms at this level

Updated