<?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: Powershell command for adding  existing snapshot policy to a volume - in Microsoft Virtualization Discussions</title>
    <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Powershell-command-for-adding-existing-snapshot-policy-to-a-volume/m-p/459311#M7033</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Hello. I don't mean to necropost, but since I had the same need and didn't find a comprehensive answer, here's an example that worked using "&lt;/SPAN&gt;Update-NcVol"&lt;SPAN&gt;&amp;nbsp;with version 9.15.1.2410 of the NetApp.ONTAP module.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;# The $querytemplate variable will be used to specify which volumes should be modified. The example specifies a specific vserver and a simple regex to match 3 volume names. You can change this to suit your environment.
$querytemplate = Get-NcVol -Template
$querytemplate.Vserver = "vserver-name"
$querytemplate.Name = "vol1|vol2|vol3"

# The $attrib variable will specify the snapshot policy to be set on the volumes that match the criteria defined in the $querytemplate variable.
$attrib = Get-NcVol -Template
Initialize-NcObjectProperty -Object $attrib -Name VolumeSnapshotAttributes
$attrib.VolumeSnapshotAttributes.SnapshotPolicy = "snap_policy"

# This will effectively change the snapshot policy on the volumes. The '-ONTAPI' parameter is used so that ZAPI is used instead of the REST API, which is the default in this version of the module.
Update-NcVol -Query $querytemplate -Attributes $attrib -ONTAPI&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 10 Mar 2025 21:57:13 GMT</pubDate>
    <dc:creator>rafael-miranda</dc:creator>
    <dc:date>2025-03-10T21:57:13Z</dc:date>
    <item>
      <title>Powershell command for adding  existing snapshot policy to a volume -</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Powershell-command-for-adding-existing-snapshot-policy-to-a-volume/m-p/168067#M6422</link>
      <description>&lt;P&gt;Hello Team,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone please help me to find the command&amp;nbsp; for adding&amp;nbsp; existing snapshot policy to a volume&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have tried with&amp;nbsp; " get-ncvol volume name&amp;nbsp; -Vserver&amp;nbsp; vserver name&amp;nbsp; &amp;nbsp;|&amp;nbsp; Set-NcSnapshotPolicy&amp;nbsp; &amp;nbsp;policy name" but failed&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;Also&amp;nbsp; I was trying&amp;nbsp; update-ncvol&amp;nbsp; as well , but could not&amp;nbsp; find snapshotpolicy name option there.&lt;/P&gt;&lt;P&gt;it looks like I am not using the current context?&lt;/P&gt;&lt;P&gt;I am using powershell tool kit 9.8.xx&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanking you in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Shyju.&lt;/P&gt;</description>
      <pubDate>Sun, 27 Jun 2021 06:38:04 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Powershell-command-for-adding-existing-snapshot-policy-to-a-volume/m-p/168067#M6422</guid>
      <dc:creator>NwkThd_04</dc:creator>
      <dc:date>2021-06-27T06:38:04Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell command for adding  existing snapshot policy to a volume -</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Powershell-command-for-adding-existing-snapshot-policy-to-a-volume/m-p/168218#M6424</link>
      <description>&lt;P&gt;Hi There&lt;/P&gt;&lt;P&gt;I was able to get this to work but only after creating a snapshot policy with a scope of the particular Storage VM&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screen Shot 2021-07-02 at 10.55.11 AM.png" style="width: 400px;"&gt;&lt;img src="https://community.netapp.com/t5/image/serverpage/image-id/11811i75D7B5CCA2113193/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Screen Shot 2021-07-02 at 10.55.11 AM.png" alt="Screen Shot 2021-07-02 at 10.55.11 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;PS C:\Users\Administrator&amp;gt; Get-NcVol -Vserver FP-Test | Set-NcSnapshotPolicy -Name test&lt;/P&gt;&lt;P&gt;Policy Enabled SnapshotPolicySchedules&lt;BR /&gt;------ ------- -----------------------&lt;BR /&gt;test True {hourly (0), daily (0), weekly (1)}&lt;BR /&gt;test True {hourly (0), daily (0), weekly (1)}&lt;BR /&gt;test True {hourly (0), daily (0), weekly (1)}&lt;BR /&gt;test True {hourly (0), daily (0), weekly (1)}&lt;BR /&gt;test True {hourly (0), daily (0), weekly (1)}&lt;BR /&gt;test True {hourly (0), daily (0), weekly (1)}&lt;BR /&gt;test True {hourly (0), daily (0), weekly (1)}&lt;BR /&gt;test True {hourly (0), daily (0), weekly (1)}&lt;BR /&gt;test True {hourly (0), daily (0), weekly (1)}&lt;BR /&gt;test True {hourly (0), daily (0), weekly (1)}&lt;BR /&gt;test True {hourly (0), daily (0), weekly (1)}&lt;/P&gt;</description>
      <pubDate>Fri, 02 Jul 2021 14:56:03 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Powershell-command-for-adding-existing-snapshot-policy-to-a-volume/m-p/168218#M6424</guid>
      <dc:creator>ajeffrey</dc:creator>
      <dc:date>2021-07-02T14:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: Powershell command for adding  existing snapshot policy to a volume -</title>
      <link>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Powershell-command-for-adding-existing-snapshot-policy-to-a-volume/m-p/459311#M7033</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Hello. I don't mean to necropost, but since I had the same need and didn't find a comprehensive answer, here's an example that worked using "&lt;/SPAN&gt;Update-NcVol"&lt;SPAN&gt;&amp;nbsp;with version 9.15.1.2410 of the NetApp.ONTAP module.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;# The $querytemplate variable will be used to specify which volumes should be modified. The example specifies a specific vserver and a simple regex to match 3 volume names. You can change this to suit your environment.
$querytemplate = Get-NcVol -Template
$querytemplate.Vserver = "vserver-name"
$querytemplate.Name = "vol1|vol2|vol3"

# The $attrib variable will specify the snapshot policy to be set on the volumes that match the criteria defined in the $querytemplate variable.
$attrib = Get-NcVol -Template
Initialize-NcObjectProperty -Object $attrib -Name VolumeSnapshotAttributes
$attrib.VolumeSnapshotAttributes.SnapshotPolicy = "snap_policy"

# This will effectively change the snapshot policy on the volumes. The '-ONTAPI' parameter is used so that ZAPI is used instead of the REST API, which is the default in this version of the module.
Update-NcVol -Query $querytemplate -Attributes $attrib -ONTAPI&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 10 Mar 2025 21:57:13 GMT</pubDate>
      <guid>https://community.netapp.com/t5/Microsoft-Virtualization-Discussions/Powershell-command-for-adding-existing-snapshot-policy-to-a-volume/m-p/459311#M7033</guid>
      <dc:creator>rafael-miranda</dc:creator>
      <dc:date>2025-03-10T21:57:13Z</dc:date>
    </item>
  </channel>
</rss>

