Read in snapshot schedules and modify without changing snap retentions

by on ‎2013-12-08 06:24 PM

This may very well be easy for people who have been using powershell for a long time, but after a couple of weeks of use I was amazed by what I can achieve.

This will allow you to export current snapshot schedules on your volumes and then re-apply a different schedule WITHOUT modifying the retention times.

#Connect to a controller, get volumes from the controller, get snapshot schedules for said volumes, and export to a csv:

Connect-NaController Controller1 | get-navol | Get-NaSnapshotSchedule | Export-Csv -path d:\something.csv

#Import the csv reading in current values and assigning each column a label.

#For each object, create a new schedule by RE-USING 4 of the 5 available columns/data fields. Note how the Labels used are the current values previously #exported - hence the values aren't changed

import-csv d:\something.csv -header ("label1","label2","label3","label4","label5") | foreach {Set-naSnapshotschedule $_.label1 -Weeks $_.label2 -Days $_.label3 -Hours $_.label4 -Whichhours "1,2,3,4,5"}

Warning!

This NetApp Community is public and open website that is indexed by search engines such as Google. Participation in the NetApp Community is voluntary. All content posted on the NetApp Community is publicly viewable and available. This includes the rich text editor which is not encrypted for https.

In accordance to our Code of Conduct and Community Terms of Use DO NOT post or attach the following:

  • Software files (compressed or uncompressed)
  • Files that require an End User License Agreement (EULA)
  • Confidential information
  • Personal data you do not want publicly available
  • Another’s personally identifiable information
  • Copyrighted materials without the permission of the copyright owner

Files and content that do not abide by the Community Terms of Use or Code of Conduct will be removed. Continued non-compliance may result in NetApp Community account restrictions or termination.