Export (0) Print
Expand All

ICommandRuntime.ShouldProcess Method (String, String)

Requests confirmation with the user by displaying the name of the resource to be changed and the action to be taken, provided by the cmdlet, and returning an answer based on the user feedback.


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

'Usage
Dim instance As ICommandRuntime
Dim target As String
Dim action As String
Dim returnValue As Boolean

returnValue = instance.ShouldProcess(target, action)

bool ShouldProcess (
	string target,
	string action
)
boolean ShouldProcess (
	String target, 
	String action
)
function ShouldProcess (
	target : String, 
	action : String
) : boolean

Parameters

target

The name of the resource the cmdlet wants to change.

action

The action the cmdlet wants to perform.

Return Value

A Boolean value that indicates true if the user wants the cmdlet to continue; false indicates that the cmdlet should not 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

Windows Developer Preview, Windows Server Developer Preview

Send comments about this topic to Microsoft.
Show:
© 2014 Microsoft