Windows Dev Center

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

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)

Dim instance As PSHostUserInterface
Dim returnValue As SecureString

returnValue = instance.ReadLineAsSecureString

Public MustOverride Function ReadLineAsSecureString As SecureString
public abstract SecureString ReadLineAsSecureString ()
public abstract function ReadLineAsSecureString () : SecureString

Return Value

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

Exception typeCondition

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.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


Target Platforms

© 2015 Microsoft