Partilhar via


ICommandRuntime2.ShouldContinue Method

Definition

Confirm an operation or grouping of operations with the user. This differs from ShouldProcess in that it is not affected by preference settings or command-line parameters, it always does the query. This variant offers Yes, No, YesToAll and NoToAll.

public:
 bool ShouldContinue(System::String ^ query, System::String ^ caption, bool hasSecurityImpact, bool % yesToAll, bool % noToAll);
bool ShouldContinue(std::wstring const & query, std::wstring const & caption, bool hasSecurityImpact, bool & yesToAll, bool & noToAll);
public bool ShouldContinue (string query, string caption, bool hasSecurityImpact, ref bool yesToAll, ref bool noToAll);
public bool ShouldContinue (string? query, string? caption, bool hasSecurityImpact, ref bool yesToAll, ref bool noToAll);
[System.Runtime.CompilerServices.NullableContext(2)]
public bool ShouldContinue (string? query, string? caption, bool hasSecurityImpact, ref bool yesToAll, ref bool noToAll);
abstract member ShouldContinue : string * string * bool * bool * bool -> bool
[<System.Runtime.CompilerServices.NullableContext(2)>]
abstract member ShouldContinue : string * string * bool * bool * bool -> bool
Public Function ShouldContinue (query As String, caption As String, hasSecurityImpact As Boolean, ByRef yesToAll As Boolean, ByRef noToAll As Boolean) As Boolean

Parameters

query
String

Textual query of whether the action should be performed, usually in the form of a question.

caption
String

Caption of the window which may be displayed when the user is prompted whether or not to perform the action. It may be displayed by some hosts, but not all.

hasSecurityImpact
Boolean

true if the operation being confirmed has a security impact. If specified, the default option selected in the selection menu is 'No'.

yesToAll
Boolean

true iff user selects YesToAll. If this is already true, ShouldContinue will bypass the prompt and return true.

noToAll
Boolean

true iff user selects NoToAll. If this is already true, ShouldContinue will bypass the prompt and return false.

Returns

If ShouldContinue returns true, the operation should be performed. If ShouldContinue returns false, the operation should not be performed, and the Cmdlet should move on to the next target resource.

Attributes

Exceptions

The pipeline has already been terminated, or was terminated during the execution of this method. The Cmdlet should generally just allow PipelineStoppedException to percolate up to the caller of ProcessRecord etc.

Not permitted at this time or from this thread. ShouldContinue may only be called during a call to this Cmdlet's implementation of ProcessRecord, BeginProcessing or EndProcessing, and only from that thread.

Applies to