Microsoft Virtualization Discussions

Trying to list schedules for all volumes enabled

ABARTHELMORT

Hello all,

I'm trying to list the snapshot schedules for all volumes that have snapshots currently enabled.

I used a simple get-navol | get-nasnapshotschedule | export-csv -path c:\snapshots.csv to try and attempt this but have noticed it is dumping all volumes (as expected) but is not showing if scheduled snapshots are enabled or not.

I'm wondering if anyone has any ideas how I could get the schedule for only those volumes with scheduled snapshots enabled.

Thanks,

Adam

4 REPLIES 4

JGPSHNTAP

I have a full dashboard that will do this, but I will get you started

$snapsched = Get-NaSnapshotSchedule $volume -erroraction "silentlycontinue"
 

 
  if ($snapsched.weeks -eq 0 -and $snapsched.days -eq 0 -and $snapsched.hours -eq 0 -and $snapsched.minutes -eq 0) {
  $snapshotsched = "No"
  } else {
  $snapshotsched = "Yes"

  }

Write-host $snapshotsched  - This will tell you if there is a snapshot schedule

But

Maybe this is something you want:

if you change

$snapsched = Get-NaSnapshotSchedule $volume -erroraction "silentlycontinue

to
$snapscheds = get-navol | Select-Object -Property @{n='targetname';e={$_.Name}} | Get-NaSnapshotSchedule

followed with:

foreach ($snapsched in $snapscheds) {

     if ($snapsched.weeks -eq 0 -and $snapsched.days -eq 0 -and $snapsched.hours -eq 0 -and $snapsched.minutes -eq 0) {
     $snapshotsched = "No"
     } else {
       $snapshotsched = "Yes"

     }

Write-host $snapshotsched  - This will tell you if there is a snapshot schedule

}

JGPSHNTAP

The other thing is it's easy to remove stuff from the pipeline, so we can find the volumes easily that don't have a schedule associated

get-navol |get-nasnapshotschedule |  ? {($_.days -eq 0) -and ($_.hours -eq 0) -and ($_.Weeks -eq 0)}

But are all your vol options nosnap set to on or you just control it through the schedule.  I was trying to craft something via one pipeline, but i think the if/else will have to do the trick

ABARTHELMORT

Thank you for your assistance.  Theoretically nosnap should be set "on" on the volumes with out snapshots but I will go through and check that as well.

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner
Public