Skip to content

Instantly share code, notes, and snippets.

@shaneis

shaneis/Test-Confirm.ps1

Last active Aug 27, 2018
Embed
What would you like to do?
Finally confirm
#region Test-Confirm
function Test-Confirm {
[CmdletBinding(SupportsShouldProcess,
ConfirmImpact = 'High')]
param(
[int[]]$Numbers
)
process {
foreach ($num in $Numbers) {
if ($PSCmdlet.ShouldProcess($num)) {
"Current numbers: [$num]"
}
}
}
}
Test-Confirm -Numbers $Numbers
#endregion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.