Hi,
Does anyone know how to delete hourly snapshot or delete the last 3 snapshot with powershell?
Thanks
Hi
All hourly:
Import-Module DataONTAP $CdotCred = Get-Credential $clustersSessions = Connect-NcController 192.168.0.90 -HTTPS -Credential $CdotCred $hourlysnap = Get-NcSnapshot -Volume "SAN1_vol1" -Controller $clustersSessions -SnapName "hourly.*" $hourlysnap $hourlysnap | Remove-NcSnapshot -Confirm
Oldest 3:
Import-Module DataONTAP $CdotCred = Get-Credential $clustersSessions = Connect-NcController 192.168.0.90 -HTTPS -Credential $CdotCred $lastxsnap = Get-NcSnapshot -Volume "SAN1_vol1" -Controller $clustersSessions | sort Created -Descending | select -last 3 $lastxsnap $lastxsnap | Remove-NcSnapshot -Confirm
If you just want to disable the creation of hourly snap on the cluster:
Cdot01::> vol show SAN1_vol1 -fields snapshot-policy vserver volume snapshot-policy ------- --------- --------------- SAN1 SAN1_vol1 default Cdot01::> snap policy show default Vserver: Cdot01 Number of Is Policy Name Schedules Enabled Comment ------------------------ --------- ------- ---------------------------------- default 3 true Default policy with hourly, daily & w eekly schedules. Schedule Count Prefix SnapMirror Label ---------------------- ----- ---------------------- ------------------- hourly 6 hourly - daily 2 daily daily weekly 2 weekly weekly Cdot01::> snap policy modify-schedule -policy default -schedule hourly -newcount 0 0 Cdot01::> snap policy show default Vserver: Cdot01 Number of Is Policy Name Schedules Enabled Comment ------------------------ --------- ------- ---------------------------------- default 3 true Default policy with hourly, daily & weekly schedules. Schedule Count Prefix SnapMirror Label ---------------------- ----- ---------------------- ------------------- hourly 0 hourly - daily 2 daily daily weekly 2 weekly weekly
Thanks Marcus