I tried to write a PowerShell script to connect to a filer, and delete all (from the oldest first) but a configurable number of snapshots on all the volumes and aggregates on the filer. I think it was probably too much of a task for my very first powershell scripting attempt. I tried debugging the script using powershell_ise but I am definitely missing a lot on how to use the DataOntap module/calls. Can anyone help?
- connect to filer
- retrieve all vols/aggr
- for every vol/aggr, delete all snapshots from the oldest leaving the most recent $keepsnaps number of snapshots from all vols and all aggregates
I need a script to delete snapshots that are more than 30 days old. Our backup software is supposed to do it but it fails every now and then leaving old snapshots on our filers. As I know absolutely nothing about scripting I would really appreciate your help in coming up with a script to meet our needs.