Information
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.

CmdletProvider.ShouldContinue Method (String, String, Boolean, Boolean)

 

Updated: April 27, 2016

Applies To: Windows PowerShell

Sends a query to the user to confirm that the operation should be performed. This variant of the method sends a query asking whether the action should be taken, a display caption, and a Boolean value that indicates whether Yes-To-All and No-To-All options are made available to the user.

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

public bool ShouldContinue(
	string query,
	string caption,
	ref bool yesToAll,
	ref bool noToAll
)

Parameters

query
Type: System.String

Query that prompts if the cmdlet should continue.

caption
Type: System.String

Caption that might be displayed when the user is prompted whether or not to perform the action. It might be displayed by some hosts, but not all.

yesToAll
Type: System.Boolean

True if and only if the user selects YesToAll. If true, ShouldProcess will bypass the prompt and return true.

noToAll
Type: System.Boolean

True if and only if the user selects NoToAll. If true, ShouldProcess will bypass the prompt and return false.

Return Value

Type: System.Boolean

A Boolean value that indicates true when the user wants the provider to perform the operation. If false is returned, the operation should not be performed and the provider should move to the next resource.

Exception Condition
PipelineStoppedException

The pipeline is stopped. The pipeline was terminated either before the call was made or while the call was in progress. In general, the provider should allow the caller of the processing record method to catch this exception.

Also, if the pipeline was terminated because of ActionPreference.Stop or ActionPreference.Inquire, the command failure will ultimately be ActionPreferenceStopException.

Windows PowerShell provides should-process and should-continue functionality to providers. Although both processes can be used to confirm an operation with the user, a call to CmdletProvider.ShouldProcess can be affected by preference settings and command-line parameters that can specify whether the query is or is not displayed to the user. A call to CmdletProvider.ShouldContinue is not affected by preference settings or command-line parameters; the query is always displayed to the user.

For more information about providers, see Windows PowerShell Providers [ps].

Return to top

Community Additions

Show: