A comprehensive PowerShell script for validating Windows Server Backup jobs, performing test restores, and ensuring backup integrity.
- Validates Windows Server Backup status
- Performs backup integrity checks
- Executes test restores of random files
- Verifies restored file integrity
- Sends notifications via email or Slack
- Generates detailed HTML reports
- Comprehensive logging
- Automated cleanup of test restores
- PowerShell 5.1 or later
- Windows Server Backup feature installed
- Administrator privileges
- SMTP server (for email notifications)
- Slack webhook URL (for Slack notifications)
- Install Windows Server Backup feature:
Install-WindowsFeature Windows-Server-Backup
-
Configure permissions:
- Run as administrator
- Ensure access to backup location
- Configure test restore location
-
Set up notification method:
- Configure SMTP settings for email notifications
- Or set up Slack webhook for Slack notifications
.\WindowsServerBackupValidator.ps1 `
-BackupTarget "E:\Backups" `
-NotificationMethod Email `
-EmailTo "admin@company.com" `
-EmailFrom "backup-alerts@company.com" `
-SmtpServer "smtp.company.com"
.\WindowsServerBackupValidator.ps1 `
-BackupTarget "E:\Backups" `
-NotificationMethod Slack `
-SlackWebhook "https://hooks.slack.com/services/YOUR/WEBHOOK/URL"
.\WindowsServerBackupValidator.ps1 `
-BackupTarget "E:\Backups" `
-TestRestorePath "D:\TestRestore" `
-NotificationMethod Email `
-EmailTo "admin@company.com"
Parameter | Required | Default | Description |
---|---|---|---|
BackupTarget | Yes | - | Path to backup location |
TestRestorePath | No | D:\TestRestore | Path for test restores |
NotificationMethod | Yes | - | Email or Slack |
EmailTo | No* | - | Email recipients |
EmailFrom | No* | - | From email address |
SmtpServer | No* | - | SMTP server hostname |
SlackWebhook | No* | - | Slack webhook URL |
TestRestoreEnabled | No | $true | Enable test restores |
*Required based on NotificationMethod
The script performs these validations:
-
Backup Status
- Last successful backup time
- Full and incremental backup times
- Backup size
- Age verification (>24h = outdated)
-
Integrity Check
- Volume-level integrity verification
- Backup set validation
- Catalog consistency
-
Test Restore
- Random file selection
- Restore verification
- File integrity validation
- Automated cleanup
Alerts are sent for:
- Failed backups
- Outdated backups
- Integrity check failures
- Test restore failures
- Script execution errors
HTML reports include:
- Backup status summary
- Integrity check results
- Test restore outcomes
- Error details
- Warning conditions
- Detailed logs in C:\Logs\WSBValidation
- Timestamp-based log files
- Color-coded console output
- Error tracking and reporting
- Schedule regular validation:
# Create scheduled task
$action = New-ScheduledTaskAction -Execute "PowerShell.exe" `
-Argument "-File C:\Scripts\WindowsServerBackupValidator.ps1 -BackupTarget 'E:\Backups' -NotificationMethod Email -EmailTo 'admin@company.com'"
$trigger = New-ScheduledTaskTrigger -Daily -At 6AM
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "WSBValidation" -Description "Daily Windows Server Backup validation"
- Monitor logs regularly
- Keep sufficient space for test restores
- Review and adjust notification settings
- Maintain email distribution lists
The script includes comprehensive error handling for:
- Backup access failures
- Integrity check errors
- Test restore failures
- Disk space issues
- Notification delivery problems
-
Backup Access Issues:
- Verify backup location accessibility
- Check permissions
- Review Windows Server Backup logs
-
Test Restore Failures:
- Check available disk space
- Verify test restore path permissions
- Review file selection criteria
-
Notification Issues:
- Verify SMTP/Slack settings
- Test network connectivity
- Check credentials
For issues and feature requests:
- Check Windows Server Backup logs
- Review script logs
- Verify permissions
- Contact system administrator