Here's a PowerShell script that will give you a comprehensive history of restore point creation:
# Get-RestorePointHistory.ps1
# Script to display Windows System Restore Point creation history
param(
[switch]$Detailed,
[int]$Last = 0,
[switch]$ExportCSV,
[string]$CSVPath = "RestorePoints_$(Get-Date -Format 'yyyyMMdd_HHmmss').csv"
)
Write-Host "Windows System Restore Point History" -ForegroundColor Cyan
Write-Host "=====================================" -ForegroundColor Cyan
Write-Host ""
try {
# Get all restore points
$restorePoints = Get-ComputerRestorePoint | Sort-Object CreationTime -Descending
if ($restorePoints.Count -eq 0) {
Write-Host "No restore points found on this system." -ForegroundColor Yellow
return
}
# Filter to last N restore points if specified
if ($Last -gt 0) {
$restorePoints = $restorePoints | Select-Object -First $Last
Write-Host "Showing last $Last restore points:" -ForegroundColor Green
} else {
Write-Host "Found $($restorePoints.Count) restore points:" -ForegroundColor Green
}
Write-Host ""
# Create custom objects for better formatting
$restorePointInfo = foreach ($rp in $restorePoints) {
# Calculate age
$age = (Get-Date) - $rp.CreationTime
$ageString = if ($age.Days -gt 0) {
"$($age.Days) days, $($age.Hours) hours ago"
} elseif ($age.Hours -gt 0) {
"$($age.Hours) hours, $($age.Minutes) minutes ago"
} else {
"$($age.Minutes) minutes ago"
}
# Determine restore point type description
$typeDescription = switch ($rp.RestorePointType) {
0 { "Application Install" }
1 { "Application Uninstall" }
10 { "Device Driver Install" }
12 { "Critical Update" }
13 { "System Checkpoint" }
14 { "Manual" }
15 { "Windows Backup" }
16 { "Windows Update" }
17 { "Cancelled Operation" }
default { "Unknown ($($rp.RestorePointType))" }
}
[PSCustomObject]@{
SequenceNumber = $rp.SequenceNumber
Description = $rp.Description
Type = $typeDescription
CreationTime = $rp.CreationTime
Age = $ageString
}
}
if ($Detailed) {
# Detailed view with more information
foreach ($rp in $restorePointInfo) {
Write-Host "Restore Point #$($rp.SequenceNumber)" -ForegroundColor Yellow
Write-Host " Description: $($rp.Description)"
Write-Host " Type: $($rp.Type)"
Write-Host " Created: $($rp.CreationTime.ToString('yyyy-MM-dd HH:mm:ss'))"
Write-Host " Age: $($rp.Age)"
Write-Host ""
}
} else {
# Table view
$restorePointInfo | Format-Table -Property @{
Name = 'Seq#'
Expression = { $_.SequenceNumber }
Width = 5
}, @{
Name = 'Description'
Expression = { $_.Description }
Width = 35
}, @{
Name = 'Type'
Expression = { $_.Type }
Width = 20
}, @{
Name = 'Created'
Expression = { $_.CreationTime.ToString('yyyy-MM-dd HH:mm') }
Width = 16
}, @{
Name = 'Age'
Expression = { $_.Age }
Width = 25
} -AutoSize
}
# Export to CSV if requested
if ($ExportCSV) {
$restorePointInfo | Export-Csv -Path $CSVPath -NoTypeInformation
Write-Host "Data exported to: $CSVPath" -ForegroundColor Green
}
# Additional system information
Write-Host ""
Write-Host "System Restore Information:" -ForegroundColor Cyan
Write-Host "===========================" -ForegroundColor Cyan
# Check if System Restore is enabled
$systemRestoreEnabled = (Get-WmiObject -Class Win32_SystemRestore).Count -gt 0
Write-Host "System Restore Status: " -NoNewline
if ($systemRestoreEnabled) {
Write-Host "Enabled" -ForegroundColor Green
} else {
Write-Host "Disabled" -ForegroundColor Red
}
# Get restore point storage information
try {
$drives = Get-WmiObject -Class Win32_Volume | Where-Object { $_.DriveLetter -ne $null }
foreach ($drive in $drives) {
$restoreConfig = Get-WmiObject -Class Win32_SystemRestoreConfig | Where-Object { $_.Drive -eq $drive.DriveLetter }
if ($restoreConfig) {
Write-Host "Drive $($drive.DriveLetter) - Restore Points: " -NoNewline
if ($restoreConfig.RestorePointCreationFrequency -eq 0) {
Write-Host "Enabled" -ForegroundColor Green
} else {
Write-Host "Disabled" -ForegroundColor Red
}
}
}
} catch {
Write-Host "Could not retrieve drive-specific restore settings."
}
} catch {
Write-Error "An error occurred while retrieving restore point information: $($_.Exception.Message)"
Write-Host ""
Write-Host "Note: This script requires administrative privileges to access restore point information." -ForegroundColor Yellow
}
Write-Host ""
Write-Host "Script completed." -ForegroundColor Cyan
Here's also a simpler version if you just want the basic information:
# Simple Restore Point History
Write-Host "System Restore Points:" -ForegroundColor Green
Write-Host "=====================" -ForegroundColor Green
Get-ComputerRestorePoint |
Sort-Object CreationTime -Descending |
Select-Object @{Name='Sequence';Expression={$_.SequenceNumber}},
@{Name='Description';Expression={$_.Description}},
@{Name='Created';Expression={$_.CreationTime.ToString('yyyy-MM-dd HH:mm:ss')}},
@{Name='Type';Expression={
switch ($_.RestorePointType) {
0 { "App Install" }
1 { "App Uninstall" }
10 { "Driver Install" }
12 { "Critical Update" }
13 { "System Checkpoint" }
14 { "Manual" }
default { "Other" }
}
}} |
Format-Table -AutoSize
Usage Examples:
# Basic usage
.\Get-RestorePointHistory.ps1
# Show detailed information
.\Get-RestorePointHistory.ps1 -Detailed
# Show only the last 5 restore points
.\Get-RestorePointHistory.ps1 -Last 5
# Export to CSV
.\Get-RestorePointHistory.ps1 -ExportCSV
# Export to specific CSV location
.\Get-RestorePointHistory.ps1 -ExportCSV -CSVPath "C:\Reports\RestorePoints.csv"
# Detailed view of last 3 restore points with CSV export
.\Get-RestorePointHistory.ps1 -Detailed -Last 3 -ExportCSV
Features:
- Shows restore point sequence number, description, type, creation time, and age
- Supports both table and detailed view formats
- Can filter to show only the most recent N restore points
- Can export data to CSV
- Shows system restore status and drive configuration
- Includes error handling
- Color-coded output for better readability
Note: You'll need to run this script with administrative privileges to access restore point information.