<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic 7-Mode Missing Snapshot Alert in Software Development Kit (SDK) and API Discussions</title>
    <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/7-Mode-Missing-Snapshot-Alert/m-p/136953#M2521</link>
    <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The attached powershell script checks the volumes of your 7-mode systems and create a list of volumes which didn't take a snapshot yesterday in a xls format then sending as an email.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am assuming that the snapshot name is hourly.0 and for snapvault, snapvault_hourly.0 you can change them to your naming&amp;nbsp;convent here : -&lt;/P&gt;&lt;PRE&gt;$snapName = "hourly.0"
$vaultSnap = "snapvault_hourly.0"&lt;/PRE&gt;&lt;P&gt;Create a txt file containing the list of your 7-mode systems and put it on the same location as the script. The file name should be : -&lt;/P&gt;&lt;PRE&gt;$netappFile = "7netapp.txt"&lt;/PRE&gt;&lt;P&gt;In case you want to exclude few volumes form the script, create a file and name it Ignore.txt and add the volumes there, one in each line : -&lt;/P&gt;&lt;PRE&gt;Select-String -Path "Ignore.txt" -CaseSensitive -Pattern "^$($_.Name)$"&lt;/PRE&gt;&lt;P&gt;The below portion is for sending an email with the list, you can modify it to has the emails you want : -&lt;/P&gt;&lt;PRE&gt;#Send the output as an attachment 
$smtpTo = "email1@domain.com, email2@domain.com"
$smtpServer = "exchange.domain.com"
$smtpFrom = "SnapShotsScript@domain.com"
$messageSubject = "SnapShots Script (7-Mode)"


#create new message to send
$message = New-Object System.Net.Mail.MailMessage $smtpfrom, $smtpto
$message.Subject = $messageSubject
$message.ReplyTo = $smtpTo
$message.IsBodyHTML = $true
$message.Attachments.Add($outputFile)

#define message body
$message.Body = “Attached is a list of volumes which didn't take a snapshot last night.”

#send the message
$smtp = New-Object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($message)
$message.Dispose() &lt;/PRE&gt;&lt;P&gt;Below is the full script : -&lt;/P&gt;&lt;PRE&gt;Clear

# the reference time which we want to have a snapshot taken at
# this will return an object referencing yesterday and named hourly.0 or snapvault_hourly.0
$refTime = [DateTime]::Today.AddDays(-1)
$snapName = "hourly.0"
$vaultSnap = "snapvault_hourly.0"
$outputFile = "No Snapshots.xls"
Out-File $outputFile


#Getting Netapp Filers List from a file called 7netapp.txt
$netappFile = "7netapp.txt"
$netappList = Get-Content $netappFile


foreach ($netapp in $netappList){

    Write-Host -ForegroundColor Yellow "`nConnecting to $netapp"
    Add-Content $outputFile "`n***********************"
    Add-Content $outputFile $netapp
    
    try{
     Connect-NaController $netapp -RPC
     Add-Content $outputFile "***********************"
        
        #Snapshots Filtering Logic Starts...
        Get-NaVol| ForEach-Object {

        #Check the ignore list
        if(Select-String -Path "Ignore.txt" -CaseSensitive -Pattern "^$($_.Name)$"){
            Write-Host -ForegroundColor Magenta "Ignoring volume $($_.Name) as it is part of the ignore list"
            } 

        # get snapshots for the volume which match the references
        elseif ( ($_ | Get-NaSnapshot | Where-Object { $_.AccessTimeDT -gt $refTime -and ($_.Name -eq $snapName -or $_.Name -eq $vaultSnap) }).count -ne 1) {

                # if there wasn't one returned, state so in red
                Write-Host -ForegroundColor Red "Volume $($_.Name) does not have a snapshot at the reference time" 
                Add-Content $outputFile $_.Name

                }
        else
            {

                # there was one returned, say so in green
                Write-Host -ForegroundColor Green "Volume $($_.Name) has a snapshot at the reference time"

                }
        }

        #Snapshots Filtering Logic Ends...
        Write-Host -ForegroundColor Yellow "Done from $netapp"

    }
    catch{
           
            Write-Host -ForegroundColor Yellow "Failure on $netapp"
            Add-Content $outputFile "Can't connect to $netapp"
               write-host $_.Exception.ToString()
               #exit 1
            }
}

#Send the output as an attachment 
$smtpTo = "email1@domain.com, email2@domain.com"
$smtpServer = "exchange.domain.com"
$smtpFrom = "SnapShotsScript@domain.com"
$messageSubject = "SnapShots Script (7-Mode)"


#create new message to send
$message = New-Object System.Net.Mail.MailMessage $smtpfrom, $smtpto
$message.Subject = $messageSubject
$message.ReplyTo = $smtpTo
$message.IsBodyHTML = $true
$message.Attachments.Add($outputFile)

#define message body
$message.Body = “Attached is a list of volumes which didn't take a snapshot last night.”

#send the message
$smtp = New-Object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($message)
$message.Dispose() &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 04 Jun 2025 14:12:15 GMT</pubDate>
    <dc:creator>ahmada</dc:creator>
    <dc:date>2025-06-04T14:12:15Z</dc:date>
    <item>
      <title>7-Mode Missing Snapshot Alert</title>
      <link>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/7-Mode-Missing-Snapshot-Alert/m-p/136953#M2521</link>
      <description>&lt;P&gt;Greetings,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The attached powershell script checks the volumes of your 7-mode systems and create a list of volumes which didn't take a snapshot yesterday in a xls format then sending as an email.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am assuming that the snapshot name is hourly.0 and for snapvault, snapvault_hourly.0 you can change them to your naming&amp;nbsp;convent here : -&lt;/P&gt;&lt;PRE&gt;$snapName = "hourly.0"
$vaultSnap = "snapvault_hourly.0"&lt;/PRE&gt;&lt;P&gt;Create a txt file containing the list of your 7-mode systems and put it on the same location as the script. The file name should be : -&lt;/P&gt;&lt;PRE&gt;$netappFile = "7netapp.txt"&lt;/PRE&gt;&lt;P&gt;In case you want to exclude few volumes form the script, create a file and name it Ignore.txt and add the volumes there, one in each line : -&lt;/P&gt;&lt;PRE&gt;Select-String -Path "Ignore.txt" -CaseSensitive -Pattern "^$($_.Name)$"&lt;/PRE&gt;&lt;P&gt;The below portion is for sending an email with the list, you can modify it to has the emails you want : -&lt;/P&gt;&lt;PRE&gt;#Send the output as an attachment 
$smtpTo = "email1@domain.com, email2@domain.com"
$smtpServer = "exchange.domain.com"
$smtpFrom = "SnapShotsScript@domain.com"
$messageSubject = "SnapShots Script (7-Mode)"


#create new message to send
$message = New-Object System.Net.Mail.MailMessage $smtpfrom, $smtpto
$message.Subject = $messageSubject
$message.ReplyTo = $smtpTo
$message.IsBodyHTML = $true
$message.Attachments.Add($outputFile)

#define message body
$message.Body = “Attached is a list of volumes which didn't take a snapshot last night.”

#send the message
$smtp = New-Object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($message)
$message.Dispose() &lt;/PRE&gt;&lt;P&gt;Below is the full script : -&lt;/P&gt;&lt;PRE&gt;Clear

# the reference time which we want to have a snapshot taken at
# this will return an object referencing yesterday and named hourly.0 or snapvault_hourly.0
$refTime = [DateTime]::Today.AddDays(-1)
$snapName = "hourly.0"
$vaultSnap = "snapvault_hourly.0"
$outputFile = "No Snapshots.xls"
Out-File $outputFile


#Getting Netapp Filers List from a file called 7netapp.txt
$netappFile = "7netapp.txt"
$netappList = Get-Content $netappFile


foreach ($netapp in $netappList){

    Write-Host -ForegroundColor Yellow "`nConnecting to $netapp"
    Add-Content $outputFile "`n***********************"
    Add-Content $outputFile $netapp
    
    try{
     Connect-NaController $netapp -RPC
     Add-Content $outputFile "***********************"
        
        #Snapshots Filtering Logic Starts...
        Get-NaVol| ForEach-Object {

        #Check the ignore list
        if(Select-String -Path "Ignore.txt" -CaseSensitive -Pattern "^$($_.Name)$"){
            Write-Host -ForegroundColor Magenta "Ignoring volume $($_.Name) as it is part of the ignore list"
            } 

        # get snapshots for the volume which match the references
        elseif ( ($_ | Get-NaSnapshot | Where-Object { $_.AccessTimeDT -gt $refTime -and ($_.Name -eq $snapName -or $_.Name -eq $vaultSnap) }).count -ne 1) {

                # if there wasn't one returned, state so in red
                Write-Host -ForegroundColor Red "Volume $($_.Name) does not have a snapshot at the reference time" 
                Add-Content $outputFile $_.Name

                }
        else
            {

                # there was one returned, say so in green
                Write-Host -ForegroundColor Green "Volume $($_.Name) has a snapshot at the reference time"

                }
        }

        #Snapshots Filtering Logic Ends...
        Write-Host -ForegroundColor Yellow "Done from $netapp"

    }
    catch{
           
            Write-Host -ForegroundColor Yellow "Failure on $netapp"
            Add-Content $outputFile "Can't connect to $netapp"
               write-host $_.Exception.ToString()
               #exit 1
            }
}

#Send the output as an attachment 
$smtpTo = "email1@domain.com, email2@domain.com"
$smtpServer = "exchange.domain.com"
$smtpFrom = "SnapShotsScript@domain.com"
$messageSubject = "SnapShots Script (7-Mode)"


#create new message to send
$message = New-Object System.Net.Mail.MailMessage $smtpfrom, $smtpto
$message.Subject = $messageSubject
$message.ReplyTo = $smtpTo
$message.IsBodyHTML = $true
$message.Attachments.Add($outputFile)

#define message body
$message.Body = “Attached is a list of volumes which didn't take a snapshot last night.”

#send the message
$smtp = New-Object Net.Mail.SmtpClient($smtpServer)
$smtp.Send($message)
$message.Dispose() &lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 04 Jun 2025 14:12:15 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Software-Development-Kit-SDK-and-API-Discussions/7-Mode-Missing-Snapshot-Alert/m-p/136953#M2521</guid>
      <dc:creator>ahmada</dc:creator>
      <dc:date>2025-06-04T14:12:15Z</dc:date>
    </item>
  </channel>
</rss>

