How to Configure Windows Service Recovery Actions
Applies to: Windows Server 2019, 2022 and 2025.
Service recovery can restart a failed service, but repeated restarts may hide a fault or worsen corrupted state.
Monitoring should collect enough evidence to diagnose trends without overwhelming storage or exposing sensitive logs. Visit networkmanager.info.
Prerequisites
- Confirm vendor supports restart.
- Identify dependencies.
- Choose thresholds.
- Enable alerting.
Procedure
Step 1: Inspect service
Read state and dependencies.
Get-Service Spooler | Format-List *Step 2: Capture current recovery
Save baseline.
sc.exe qfailure SpoolerStep 3: Configure recovery
Set two restart attempts.
sc.exe failure Spooler reset= 86400 actions= restart/60000/restart/60000/none/0Step 4: Test
Stop in maintenance and observe recovery.
Step 5: Monitor events
Watch 7031 and 7034.
Verification
Query recovery and recent events.
sc.exe qfailure Spooler
Get-WinEvent -FilterHashtable @{LogName='System';Id=7031,7034;StartTime=(Get-Date).AddHours(-2)}Rollback
Restore the recorded recovery settings or configure take-no-action during investigation.
Operational notes
Use the real business service; Spooler is only an example.
Official references
Explore Netcloud24 Canada.