A PowerShell utility module for creating resumable scripts with automatic state persistence.
Test.ps1.mp4
- Each step is tracked by its location in the script (file:line)
- State is saved after each successful step in a
.stepperfile (includesScriptContents,LastCompletedStep, timestamp, and persisted$Stepperdata) - On resume, completed steps can be skipped automatically
- If the script has changed between runs, Stepper prompts the user to Resume, Start over (removes the state file), view More details, or Quit
- Non-resumable code is detected and can be suppressed with
#region Stepper ignore/#endregion Stepper ignoreor handled interactively - Use the More details view to inspect saved step body, Stepper variables, and restart context
- Call
Stop-Stepperat the end to clean up
Install-Module -Name StepperWrap your script steps in New-Step blocks. If the script fails inside of a New-Step block, the next run of the script resumes at the step that failed.
#Requires -Modules Stepper
[CmdletBinding()]
param()
New-Step {
Write-Host "Step 1: Download files..."
# Your code here
}
New-Step {
Write-Host "Step 2: Process data..."
# Your code here
}
New-Step {
Write-Host "Step 3: Upload results..."
# Your code here
}
Stop-StepperUse the $Stepper variable to share data between steps:
New-Step {
$Stepper.Data = Get-Process
}
New-Step {
$Stepper.Data | Where-Object CPU -gt 100
}MIT with Commons Clause - see LICENSE