<?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 Re: Script for Volumes not Taking snapshots in Microsoft Virtualization Discussions</title>
    <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Script-for-Volumes-not-Taking-snapshots/m-p/125647#M5144</link>
    <description>&lt;P&gt;Thanks a lot worked like a charm &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For some reason when I converted it for 7-mode '-eq' wasn't working as expected. I replaced it with '-gt' and had to settel to a snpashot named hourly.0 was taken yesterday &lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://community.netapp.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;# the reference time which we want to have a snapshot taken at
# this will return an object referencing yesterday at 8pm
$refTime = [DateTime]::Today.AddDays(-1)
$snapName = "hourly.0"
$password = ConvertTo-SecureString "Netapp1!" -AsPlainText -Force
$cred = New-Object -TypeName System.Management.Automation.PSCredential  -ArgumentList "root",$password

#Connect to Filer
Connect-NaController 192.168.1.212 -Credential $cred


Get-NaVol| ForEach-Object {

    # get snapshots for the volume which match the reference time
    if ( ($_ | Get-NaSnapshot | Where-Object { $_.AccessTimeDT -gt $refTime -and $_.Name -eq $snapName }).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"

    } else {

        # there was one returned, say so in green
        Write-Host -ForegroundColor Green "Volume $($_.Name) has a snapshot at the reference time"

    }
}&lt;/PRE&gt;&lt;P&gt;Thanks again, your help made my day&lt;/P&gt;</description>
    <pubDate>Thu, 24 Nov 2016 07:33:44 GMT</pubDate>
    <dc:creator>ahmada</dc:creator>
    <dc:date>2016-11-24T07:33:44Z</dc:date>
    <item>
      <title>Script for Volumes not Taking snapshots</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Script-for-Volumes-not-Taking-snapshots/m-p/125269#M5129</link>
      <description>Greetings,&lt;BR /&gt;8.2.4 7-mode&lt;BR /&gt;I am looking for a script that will show me which volumes didn't take snapshots last night.&lt;BR /&gt;&lt;BR /&gt;All my volumes are scheduled to take snapshots at 20:00 PM</description>
      <pubDate>Wed, 04 Jun 2025 18:19:15 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Script-for-Volumes-not-Taking-snapshots/m-p/125269#M5129</guid>
      <dc:creator>ahmada</dc:creator>
      <dc:date>2025-06-04T18:19:15Z</dc:date>
    </item>
    <item>
      <title>Re: Script for Volumes not Taking snapshots</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Script-for-Volumes-not-Taking-snapshots/m-p/125614#M5142</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.netapp.com/t5/user/viewprofilepage/user-id/1504"&gt;@ahmada﻿&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is one version, though you could do a rudimentary check beforehand to see if the number of snapshots taken at the desired time matches the number of volumes. &amp;nbsp;If they don't match, then start looking for the volumes which are missing a snapshot.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;# the reference time which we want to have a snapshot taken at
# this will return an object referencing yesterday at 8pm
$refTime = [DateTime]::Today.AddDays(-1).AddHours(20)

# get only volumes with the snapshot policy we want
Get-NcVol -Query @{ VolumeSnapshotAttributes = @{ SnapshotPolicy = "default" } } | ForEach-Object {

    # get snapshots for the volume which match the reference time
    if ( ($_ | Get-NcSnapshot | Where-Object { $_.AccessTimeDT -eq $refTime }).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"

    } else {

        # there was one returned, say so in green
        Write-Host -ForegroundColor Green "Volume $($_.Name) has a snapshot at the reference time"

    }
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that this is for Clustered ONTAP. &amp;nbsp;The 7-mode cmdlets used will be slightly different (I don't have a 7-mode system to test against), but the principle is the same.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Andrew&lt;/P&gt;</description>
      <pubDate>Tue, 22 Nov 2016 21:59:24 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Script-for-Volumes-not-Taking-snapshots/m-p/125614#M5142</guid>
      <dc:creator>asulliva</dc:creator>
      <dc:date>2016-11-22T21:59:24Z</dc:date>
    </item>
    <item>
      <title>Re: Script for Volumes not Taking snapshots</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Script-for-Volumes-not-Taking-snapshots/m-p/125647#M5144</link>
      <description>&lt;P&gt;Thanks a lot worked like a charm &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For some reason when I converted it for 7-mode '-eq' wasn't working as expected. I replaced it with '-gt' and had to settel to a snpashot named hourly.0 was taken yesterday &lt;img id="smileyvery-happy" class="emoticon emoticon-smileyvery-happy" src="https://community.netapp.com/i/smilies/16x16_smiley-very-happy.png" alt="Smiley Very Happy" title="Smiley Very Happy" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;# the reference time which we want to have a snapshot taken at
# this will return an object referencing yesterday at 8pm
$refTime = [DateTime]::Today.AddDays(-1)
$snapName = "hourly.0"
$password = ConvertTo-SecureString "Netapp1!" -AsPlainText -Force
$cred = New-Object -TypeName System.Management.Automation.PSCredential  -ArgumentList "root",$password

#Connect to Filer
Connect-NaController 192.168.1.212 -Credential $cred


Get-NaVol| ForEach-Object {

    # get snapshots for the volume which match the reference time
    if ( ($_ | Get-NaSnapshot | Where-Object { $_.AccessTimeDT -gt $refTime -and $_.Name -eq $snapName }).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"

    } else {

        # there was one returned, say so in green
        Write-Host -ForegroundColor Green "Volume $($_.Name) has a snapshot at the reference time"

    }
}&lt;/PRE&gt;&lt;P&gt;Thanks again, your help made my day&lt;/P&gt;</description>
      <pubDate>Thu, 24 Nov 2016 07:33:44 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Script-for-Volumes-not-Taking-snapshots/m-p/125647#M5144</guid>
      <dc:creator>ahmada</dc:creator>
      <dc:date>2016-11-24T07:33:44Z</dc:date>
    </item>
  </channel>
</rss>

