UseShouldProcessForStateChangingFunctions
Severity Level: Warning
Description
Functions whose verbs change system state should support ShouldProcess
.
Verbs that should support ShouldProcess
:
New
Set
Remove
Start
Stop
Restart
Reset
Update
How
Include the SupportsShouldProcess
argument in the CmdletBinding
attribute.
Example
Wrong
function Set-ServiceObject
{
[CmdletBinding()]
param
(
[string]
$Parameter1
)
...
}
Correct
function Set-ServiceObject
{
[CmdletBinding(SupportsShouldProcess = $true)]
param
(
[string]
$Parameter1
)
...
}
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for