Export (0) Print
Expand All

ICommandRuntime.ShouldProcess Method (String, String, String)

Requests confirmation with the user by displaying the action to be taken, a query asking if the cmdlet should continue, a caption for the prompt, and returning an answer based on the user feedback.

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

Dim instance As ICommandRuntime
Dim verboseDescription As String
Dim verboseWarning As String
Dim caption As String
Dim returnValue As Boolean

returnValue = instance.ShouldProcess(verboseDescription, verboseWarning, caption)

bool ShouldProcess (
	string verboseDescription,
	string verboseWarning,
	string caption
boolean ShouldProcess (
	String verboseDescription, 
	String verboseWarning, 
	String caption
function ShouldProcess (
	verboseDescription : String, 
	verboseWarning : String, 
	caption : String
) : boolean



A description of the action the cmdlet wants to perform. This is what is displayed to the user for ActionPreference.Continue.


A query that asks whether the action should be performed. This is what is displayed to the user for ActionPreference.Inquire.


The caption to display as part of the prompt (such as the window title in a dialog box).

Return Value

A Boolean value that indicates true if the user wants the cmdlet to continue; false indicates not to continue.

Cmdlets call ShouldProcess before the cmdlet makes a change to the system, such as deleting files or stopping services.

The implementation of this method should take into account command-line settings and preference variables in determining whether it should prompt the user and what it should return.

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

© 2015 Microsoft