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

virtual SecureString^ ReadLineAsSecureString () abstract
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

Windows 98, Windows 2000, Windows 2000 Server, Windows CE, Windows Server 2008, Windows 98 Second Edition, Pocket PC, Smart Phone, Windows Server 2003, Windows XP Professional, Windows Vista, Windows Server 2003 R2, Windows XP, Windows 7, Windows 2008 R2, Windows Developer Preview, Windows Server Developer Preview

Send comments about this topic to Microsoft.
© 2014 Microsoft