PSHostUserInterface.Prompt Method

When overridden in a derived class, prompts the user for input.

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

Dim instance As PSHostUserInterface
Dim caption As String
Dim message As String
Dim descriptions As Collection(Of FieldDescription)
Dim returnValue As Dictionary(Of String, PSObject)

returnValue = instance.Prompt(caption, message, descriptions)

Public MustOverride Function Prompt ( _
	caption As String, _
	message As String, _
	descriptions As Collection(Of FieldDescription) _
) As Dictionary(Of String, PSObject)
public abstract Dictionary<String,PSObject> Prompt (
	String caption, 
	String message, 
	Collection<FieldDescription> descriptions
public abstract function Prompt (
	caption : String, 
	message : String, 
	descriptions : Collection<FieldDescription>
) : Dictionary<String,PSObject>



The text that precedes the prompt.


The text of the prompt.


A Collection of FieldDescription objects that contains the user input.

Return Value

A Dictionary of types String and PSObject that contains the results of the user prompts. The keys of the dictionary are the field names from the FieldDescription objects. The dictionary values are objects that represent the values of the corresponding fields as collected from 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.

To the extent possible, the host should return values of the type(s) identified in the FieldDescription objects. When that is not possible (for example, the type is not available to the host), the host should return the value as a string.

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