Deletes checkpoints older than the configured age across all VMs on a host, logging each one with its VM and creation date. Afterwards it waits and reports which VMs are still merging disks in the background — the part that surprises people, because the storage load arrives after the script says it is done.
powershell
# Hyper-V Remove Old Checkpoints
# Single use case: delete checkpoints older than N days (all VMs)
#-----------------------------------------------------------------
function Write-Log {
param($Message)
Write-Host "<WRITE-LOG = `"*$Message*`">"
}
# --- Parameters (replace via ServerEngine API parameters if needed) ---
$OlderThanDays = 14
if (-not (Get-Module -ListAvailable -Name Hyper-V)) {
Write-Log "Hyper-V module not available - is the Hyper-V role installed on this host?"
return
}
$cutoff = (Get-Date).AddDays(-[int]$OlderThanDays)
$snaps = Get-VMSnapshot -VMName * -ErrorAction SilentlyContinue | Where-Object { $_.CreationTime -lt $cutoff }
if (-not $snaps) {
Write-Log "No checkpoints older than $OlderThanDays days found - nothing to do."
return
}
Write-Log "Removing $(@($snaps).Count) checkpoint(s) older than $($cutoff.ToString('yyyy-MM-dd'))..."
$removed = 0
foreach ($s in $snaps) {
Write-Log "Removing: [$($s.VMName)] '$($s.Name)' from $($s.CreationTime.ToString('yyyy-MM-dd'))..."
Remove-VMSnapshot -VMName $s.VMName -Name $s.Name -ErrorAction SilentlyContinue
$removed++
}
Write-Log "Waiting for disk merges to settle..."
Start-Sleep 5
$merging = Get-VM | Where-Object { $_.Status -match "Merge" }
if ($merging) {
Write-Log "Note: $(@($merging).Count) VM(s) still merging disks in the background - IO load until finished."
}
Write-Log "Checkpoint cleanup complete: $removed checkpoint(s) removed."Run it across your fleet
This script runs as-is on a single host. Paste it into ServerEngine to schedule it, run it on a whole server group in parallel, and keep the credentials out of the file — see the scripts documentation and the credential store.
More in Hyper-V
Create a Hyper-V Checkpoint with PowerShell
2026-08-17Start a Hyper-V VM with PowerShell
2026-08-17Shut Down a Hyper-V VM with PowerShell
2026-08-17Efficient Hyper-V VM Status Reporting Script
2025-01-10Hyper-V Virtual Machine Snapshot Management Script
2025-01-10Automated Virtual Machine Restart with PowerShell and Hyper-V
2025-01-10Ready when you are.
Try ServerEngine free for 7 days.