Microsoft Virtualization Discussions

Highlighted

Need help scripting

I need some help coming up with the script to check these snapdive snapshots for ones older than 30 days and deleteing them.  I can't change naming conventions.  The naming convention is adding get-date -format yyyyMMddHHmmss to "windows-". Any thoughts?

2 REPLIES 2
Highlighted

Re: Need help scripting

Not sure if you figured this out already but for anyone else... the lines below will get the current date, list volumes, filter out offline volumes and ignore read-only volumes, get each of their snapshots older than 30days where there is no dependency(clone, etc) on the volume and then finally remove the snapshots. Hope that helps.

$Now = get-date

get-navol | where-object {$_.State -eq "online" -and $_.raidstatus -notlike "*read-only"} | get-nasnapshot | where-object {$_.AccessTimeDT -le $Now.AddDays(-30) -and $_.Dependency -eq ""} | remove-nasnapshot

Highlighted

Re: Need help scripting

Thanks Nick.  I did figure it out.  I'll post it soon.  I'm going to try what you have provided.  Looks good.

View solution in original post

Try the NEW Support Site!
NetApp Support Site
Forums