Introduction
Hyper-V is one of virtualization software which has an ability to create a VM checkpoint. We can use this feature to roll back the virtual machine to a previous state. It usually used to take a backup temporarily when we’re doing VM configuration changes, or windows updates.
Instead of using a full backup, it will be more simply to restore it through a VM checkpoint. The application and Operating system running on a virtual machine will be rolled back to the previous state after we do a checkpoint restore.


However, before doing a snapshot, we need to understand that in
If we’re working on a managed customer business environment and handle a lot of customers, we need to make sure that all owned customer’s server is up-to-date. In order to minimize the downtime and speed up the troubleshooting process when the problem comes after applying update, restoring the VM from checkpoint is the best option to do it.
The problem here is when we’re managing windows update for a lot of customers, in some cases, we don’t remember to clean up the snapshot, and let the VM still in under snapshot that will affect to the storage disk usage and VM performance.
So here is the simple script to send an alert if a VM’s snapshot is available. The script will send an alert contains which the VM has a snapshot, and where the VM is hosted
You can modify and change the parameter as needed. You can also run this script on a schedule. Please review step by step running a
# ***********************************#
## Hyper V snapshot Alert ##
# ***********************************#
# Customer and server information | filtering for a standard snapshot type only.
$Customer = "Customer Name"
$servers = "SERVER1","SERVER2"
$snapshots = Get-VM -ComputerName $servers | Get-VMSnapshot -SnapshotType "Standard"
# Email Configuration
$from = "[email protected]"
$to = "[email protected]"
$subject "$customer - Hyper-V Snapshot Alert"
$smtpServer "mail.amanulloh.com"
# Check VM Snapshot
if ($snapshots.count -gt 0){
$alert = $snapshots | ft ComputerName, VMName, CreationTime, CheckpointType -auto | Out-String
# Send Alert to customer
Send-MailMessage $from $to $subjet $SmtpServer
-Body "The following is VM list with checkpoint:`n `n $alert`n Note,`n
The checkpoint's type is STANDARD, which means it was created by someone a few days ago (not created by a backup software -like DPM, VEEAM or ACRONIS). `n Don't forget to always delete the snapshot 3 days after Windows Update Maintenance, or inform this to customer to get the customer approval or propose a schedule if needed."
}
Please comment if you think that this article is useful.
Thank you.