Snapshots Using VMware


Badge +1
code:

Import-Csv "C:\VMnames.csv" | %{
Get-VM $_.Name | New-Snapshot -Name "Daily snapshots" -Quiesce:$true -Confirm:$false
}
$fivedaysago = (Get-Date).AddDays(-5)
Get-VM | Get-Snapshot | %{
if($_.Created.CompareTo($fivedaysago) -eq -1){
Remove-Snapshot $_ -Confirm:$false
}
}

1 reply

Userlevel 7
Badge +35
Thanks for sharing @Witz

You able to add any additional context around the use of the script? 👍

Reply