Microsoft Virtualization Discussions
Microsoft Virtualization Discussions
Looking to powershell to find what volumes have Snapshots enabled and what snapshot policy is being used. I know you can use Get-NcSnapshotPolicy to see the policies, but does not show which volumes it is applied to.
I have not been able to find a PS command that shows what volumes have snapshots enabled. Get-NcSnapshot shows the current snapshots and outputs the volume, but i cant filter show volumes it is not enabled on.
Solved! See The Solution
Get the folllowing error:
This cmdlet must be directed to a data vserver. You are currently connected |
| to the cluster admin vserver. See the Toolkit web docs (Show-NcHelp) or online |
| help (Get-Help Connect-NcController -Examples) to learn more about directing |
| Toolkit cmdlets to a cluster or data vserver as required by Data ONTAP.
Was hoping to run it at the cluster, so it would check all SVMs.
That worked, but shows vault and mirror destination volumes.
Ok, back at a real computer...
There's a few things that we want to accomodate when checking for volumes which do not have snapshot protection:
With all that in mind, we can use PowerShell to check for these things, filtering the things we want and don't want:
Get-NcVol | ?{ # get non-root volumes $_.VolumeStateAttributes.IsNodeRoot -eq $false ` -and # which are rw (this will exclude SnapMirror, etc.) $_.VolumeIdAttributes.Type -eq "rw" ` -and ( # with "nosnap" turned on (($_ | Get-NcVolOption -Hashtable).value.nosnap -eq "on") ` -or # or with snapshot policy set to none ($_.VolumeSnapshotAttributes.SnapshotPolicy -eq "none") ) }
Hope that helps.
Andrew
Both of them work great
Also, to answer the second part of your original post, how to view the volume and it's snapshot policy:
Get-NcVol | Select Vserver,Name,@{N="Snapshot Policy"; E={ $_.VolumeSnapshotAttributes.SnapshotPolicy }}
Andrew
@asulliva wrote:
Also, to answer the second part of your original post, how to view the volume and it's snapshot policy:
Get-NcVol | Select Vserver,Name,@{N="Snapshot Policy"; E={ $_.VolumeSnapshotAttributes.SnapshotPolicy }}Andrew
Just stumbled across this thread as i was looking for the same thing. The above command works great.....except it truncates some of myoutput like this:
vserve... abVolume1 vserver1__standard_po...
How can I tidy up the output so i can see the full text?
TIA