ISCSI Target Scheduled Snapshots
i know there cmdlets snapshot target there built in way schedule snapshots?
alternatively, there cmdlet list snapshots target can create script run on schedule remove old snapshots , create new ones.
i forgot mention i'm using server 2012 r2. i can't find ui in server 2012 r2 scheduling snapshots.
here script wrote. you can create scheduled task in windows run daily.
$daystokeep = 7; $disks = get-iscsivirtualdisk foreach($disk in $disks){ $snapshots = get-iscsivirtualdisksnapshot $disk.path; write-host "" write-host "deleting old snapshots disk" $disk.path; foreach($snapshot in $snapshots){ $snapshotdate = $snapshot.timestamp; $snapshotfound = $false if($snapshotdate -lt (get-date).adddays(-$daystokeep)){ $snapshotfound = $true write-host "deleting snapshot" $snapshot.snapshotid; remove-iscsivirtualdisksnapshot $snapshot.snapshotid; write-host "snapshot" $snapshot.snapshotid "deleted"; write-host ""; } } if($snapshotfound -ne $true){ write-host "no snapshots found"; } write-host "done" write-host ""; write-host "creating snapshot disk" $disk.path; $newsnapshot = checkpoint-iscsivirtualdisk $disk.path; write-host "snapshot" $newsnapshot.snapshotid "created"; } write-host "" write-host "" write-host "script complete"
Windows Server > File Services and Storage
Comments
Post a Comment