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::Prompt Method (String^, String^, Collection<FieldDescription^>^)


Updated: April 27, 2016

Applies To: Windows PowerShell

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)

virtual Dictionary<String^, PSObject^>^ Prompt(
	String^ caption,
	String^ message,
	Collection<FieldDescription^>^ descriptions
) abstract


Type: System::String^

The text that precedes the prompt.

Type: System::String^

The text of the prompt.

Type: System.Collections.ObjectModel::Collection<FieldDescription^>^

A Collection<T> of FieldDescription objects that contains the user input.

Return Value

Type: System.Collections.Generic::Dictionary<String^, PSObject^>^

A Dictionary<TKey, TValue> 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 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.

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.

Return to top

Community Additions