PSHostUserInterface.PromptForCredential Method (String, String, String, String)

When overridden in a derived class, prompts the user for credentials with a specified prompt window caption, prompt message, user name, and target name.


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

'Usage
Dim instance As PSHostUserInterface
Dim caption As String
Dim message As String
Dim userName As String
Dim targetName As String
Dim returnValue As PSCredential

returnValue = instance.PromptForCredential(caption, message, userName, targetName)

public abstract PSCredential PromptForCredential (
	string caption,
	string message,
	string userName,
	string targetName
)
public abstract PSCredential PromptForCredential (
	String caption, 
	String message, 
	String userName, 
	String targetName
)
public abstract function PromptForCredential (
	caption : String, 
	message : String, 
	userName : String, 
	targetName : String
) : PSCredential

Parameters

caption

The caption for the message window.

message

The text of the message.

userName

The user name whose credential is to be prompted for. If this parameter set to null or an empty string, the function prompts for the user name first.

targetName

The name of the target for which the credential is collected.

Return Value

A PSCredential object that contains the credentials for the target.

Exception typeCondition
HostException

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

NotImplementedException

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

RuntimeException

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

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


Show:
© 2014 Microsoft