Skip to content

Instantly share code, notes, and snippets.

@techthoughts2
Last active January 3, 2023 04:34
Show Gist options
  • Save techthoughts2/31e857594e541be9fa3bc72375ef4f6e to your computer and use it in GitHub Desktop.
Save techthoughts2/31e857594e541be9fa3bc72375ef4f6e to your computer and use it in GitHub Desktop.
# https://learn.microsoft.com/en-us/powershell/scripting/learn/deep-dives/everything-about-shouldprocess?view=powershell-7.3
[CmdletBinding(ConfirmImpact = 'Low',
SupportsShouldProcess = $true)]
# $PSCmdlet.ShouldProcess('TARGET')
# $PSCmdlet.ShouldProcess('TARGET','OPERATION')
# $PSCmdlet.ShouldProcess('MESSAGE','TARGET','OPERATION')
# -Confirm --> $ConfirmPreference = 'Low'
# ShouldProcess intercepts WhatIf* --> no need to pass it on
if ($Force -or $PSCmdlet.ShouldProcess($DestinationPath, "Scaffolding module project with: $($ModuleParameters | Out-String)")) {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment