Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions src/MaintenancePlan/Public/Invoke-MaintenancePlan.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading