ShouldProcess in #PowerShell Pipeline

  • 0

ShouldProcess in #PowerShell Pipeline

Line Break

Author: Frank Peter (97 Articles)

Did you know? You can leverage the $PSCmdlet.ShouldProcess method within a Pipeline as follows:

Although this is a no-brainer for PowerShell pros I never saw usage of $PSCmdlet.ShouldProcess in conjunction with Where-Object.

The example below is a small script with WhatIf support that removes disabled AD users:

Watch out! The script removes AD users.


Leave a Reply

*