The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

PSHostUserInterface.ReadLineAsSecureString Method ()


Updated: April 27, 2016

Applies To: Windows PowerShell

When overridden in a derived class, reads characters entered by the user until a newline (carriage return) character is encountered and returns the characters as a secure string.

Namespace:   System.Management.Automation.Host
Assembly:  System.Management.Automation (in System.Management.Automation.dll)

Public MustOverride Function ReadLineAsSecureString As SecureString

Return Value

Type: System.Security.SecureString

A SecureString object that contains the characters that are entered by the user.

Exception Condition

The host can throw this exception when it cannot complete an operation.


If this method is not implemented, the host should throw a "not implemented" exception when it receives this call.


The host can throw this exception when an error occurs while a command is running.

This method is similar to the ReadLine method with the exception that the characters are returned as a SecureString object and that they are not echoed to the user as plain text (or in a secure way, such as showing a dot for each character) while the characters are collected.

Return to top

Community Additions