From 435b07586080ee32185bddc0b7b4cfe57b856b0b Mon Sep 17 00:00:00 2001 From: Christian Zagazeta <46060355+yourlastnamesoundslikeatypeofpasta@users.noreply.github.com> Date: Mon, 9 Jun 2025 17:26:16 -0400 Subject: [PATCH] Remove custom WhatIf param --- src/MaintenancePlan/Public/Invoke-MaintenancePlan.ps1 | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/MaintenancePlan/Public/Invoke-MaintenancePlan.ps1 b/src/MaintenancePlan/Public/Invoke-MaintenancePlan.ps1 index 71e7d54e..7cbee540 100644 --- a/src/MaintenancePlan/Public/Invoke-MaintenancePlan.ps1 +++ b/src/MaintenancePlan/Public/Invoke-MaintenancePlan.ps1 @@ -4,20 +4,17 @@ function Invoke-MaintenancePlan { Execute all steps in a maintenance plan. .PARAMETER Plan Plan object created by New-MaintenancePlan or Import-MaintenancePlan. - .PARAMETER WhatIf - Display commands without executing. #> [CmdletBinding(SupportsShouldProcess=$true)] param( [Parameter(Mandatory)] [ValidateNotNull()] - [object]$Plan, - [switch]$WhatIf + [object]$Plan ) Assert-ParameterNotNull $Plan 'Plan' foreach ($step in $Plan.Steps) { Write-STStatus "Running $step" -Level INFO -Log - if (-not $WhatIf) { + if ($PSCmdlet.ShouldProcess($step)) { if (Test-Path $step) { & $step } else {