Cmdlet::ShouldContinue Method (String^, String^)
Updated: April 27, 2016
Applies To: Windows PowerShell
Requests confirmation of an operation from the user by sending a second query to the user.
Assembly: System.Management.Automation (in System.Management.Automation.dll)
The query that confirms whether the cmdlet should continue. For more information, see the following code examples.
The caption that is displayed above the query. This caption can be displayed in a window that might be displayed by some, but not all, hosts. For more information, see the following code examples.
Return ValueType: System::Boolean
A value of true indicates that the cmdlet should perform the operation. A value of false indicates that the operation should not be performed and the cmdlet should move to the next resource.
Thrown when the pipeline is stopped. The pipeline was terminated either before the call was made or while the call was in progress. By default, the cmdlet 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.
Thrown when the call cannot be completed at this time or cannot be completed from this thread. For more information, see the following Remarks section.
A call tois not affected by preference settings or by command-line parameters; the query is always displayed to the user.
Cmdlets callingshould also implement a Force parameter that allows the cmdlet to bypass these calls. If this is not done, it will be difficult to use the cmdlet from scripts and noninteractive hosts.
This method can be called only from within the cmdlet implementation of the BeginProcessing, ProcessRecord, and EndProcessing methods and only from that thread. If this call is made from outside these implementations or from another thread, an InvalidOperationException exception is thrown.
For more information about cmdlets, see Windows PowerShell Cmdlets.
In the following code example, the call todoes not specify a caption or query so the default text is displayed.
In the following code example, the call to themethod specifies a caption and query.