Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Powershell command for adding existing snapshot policy to a volume -
2021-06-26
11:38 PM
2,881 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Team,
Anyone please help me to find the command for adding existing snapshot policy to a volume
I have tried with " get-ncvol volume name -Vserver vserver name | Set-NcSnapshotPolicy policy name" but failed
Also I was trying update-ncvol as well , but could not find snapshotpolicy name option there.
it looks like I am not using the current context?
I am using powershell tool kit 9.8.xx
Thanking you in advance.
Regards,
Shyju.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi There
I was able to get this to work but only after creating a snapshot policy with a scope of the particular Storage VM
PS C:\Users\Administrator> Get-NcVol -Vserver FP-Test | Set-NcSnapshotPolicy -Name test
Policy Enabled SnapshotPolicySchedules
------ ------- -----------------------
test True {hourly (0), daily (0), weekly (1)}
test True {hourly (0), daily (0), weekly (1)}
test True {hourly (0), daily (0), weekly (1)}
test True {hourly (0), daily (0), weekly (1)}
test True {hourly (0), daily (0), weekly (1)}
test True {hourly (0), daily (0), weekly (1)}
test True {hourly (0), daily (0), weekly (1)}
test True {hourly (0), daily (0), weekly (1)}
test True {hourly (0), daily (0), weekly (1)}
test True {hourly (0), daily (0), weekly (1)}
test True {hourly (0), daily (0), weekly (1)}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 "Update-NcVol" with version 9.15.1.2410 of the NetApp.ONTAP module.
# 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
