CmdletBindingAttribute.SupportsShouldProcess Property

Gets and sets a Boolean value that indicates whether the function supports calls to the ShouldProcess method. This call is used to request confirmation from the user before the function performs some action.

Namespace: System.Management.Automation
Assembly: System.Management.Automation (in system.management.automation.dll)

Usage

Syntax

'Declaration
Public Property SupportsShouldProcess As Boolean
public bool SupportsShouldProcess { get; set; }
public:
virtual property bool SupportsShouldProcess {
    bool get () sealed;
    void set (bool value) sealed;
}
/** @property */
public final boolean get_SupportsShouldProcess ()

/** @property */
public final void set_SupportsShouldProcess (boolean value)
public final function get SupportsShouldProcess () : boolean

public final function set SupportsShouldProcess (value : boolean)

Property Value

Returns a Boolean value that indicates true if the function supports calls to the ShouldProcess method.

Remarks

All functions that change the system should include the SupportsShouldProcess keyword when declaring the CmdletBinding attribute. If the ShouldProcess method returns true, the function should perform its action. If the ShouldProcess method returns false, the action should not be taken.

If a function supports the ShouldProcess method, the Confirm and WhatIf parameters are added to the function by Windows PowerShell.

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Platforms

Development Platforms

Windows Server 2008, Windows Vista, Windows Server 2003, Windows XP

Target Platforms

Windows Server 2008, Windows Server 2003, Windows Vista, Windows XP

See Also

Reference

CmdletBindingAttribute Class
CmdletBindingAttribute Members
System.Management.Automation Namespace

Other Resources

Windows PowerShell SDK