How automatically snapshot Hyper-V VMs Workflow PS Script
Open your Windows Power Shell ISE as administrator. 1. Create a Folder to store your scripts . New-Item C:\Scripts –ItemType Directory 2. Create the following scripts . First create the Script for Checkpoints (AKA Snapshots) copy the script below. File name cloud be VMCheclpointdailyjob.ps1 #This script was created to run daily snapshots of VMs Get-VM SVRVM* | checkpoint-vm -SnapshotName "Daily Snapshot $(( Get-Date ).toshortdatestring())" –AsJob Second create the Script for Remove VM Snapshots, copy the script below. File name cloud be VMRemoveCheckpoints.ps1 At this point you can change what days you want to delete more days you can change the (Get-Date).AddDays(- #) . #Script to Remove VM Snapshots Get-VMSnapshot -VMName SVRVM* | Where-Object {$_.CreationTime -lt ( Get-Date ).AddDays(-5) } | Remove-VMSnapshot 3. Set the Task Scheduler to automate this pr...



Comments
Post a Comment