You will need the DataONTap module for Powershell for these commands to work. If you already have the DataONTap modules installed you can load it in your current PowerShell session with the command
Import-Module DataONTap
You will then need to connect to the NetApp filer you want to work with using the command
Connect-NaController
Optionally you can specify a user to authenticate with by specifying the credential parameter, i.e.
Connect-NaController -credential
For example
Connect-NaController NetApp01 –credential root
You can then get a list of the volume options for a specific volume with the command
Get-NaVolOption –Name
For example
Get-NaVolOption -Name vol0
What I was interested in finding out was the value of nosnapdir for all of the volumes on the filer so I used the following one liner
$vols = Get-NaVol ; ForEach ($vol in $vols) {$Results = “” | Select Volume, nosnapdir ; $Results.Volume = $vol.name ; $Results.nosnapdir = (Get-NaVolOption $vol | Where {$_.name -eq “nosnapdir”}).Value ; $Results }
I’m sure there is a way to pipe the input into the ForEach command. I will have to look that up to improve the command line.
I then improved this into a small script that could be used to return the value of any of the volume options for all volumes on the connected filer, as below:
Param([Parameter(Mandatory=$true)]$VolOption)
if ($VolOption) {
$vols
=
Get-NaVol
ForEach ($vol
in
$vols) {
$Results
=
“” | Select Volume,$VolOption
$Results.Volume =
$vol.name
$Results.$VolOption
= (Get-NaVolOption
$vol | where {$_.name -eq
$VolOption}).Value
$Results
}
}
You can then run this script passing a parameter of the Volume Option you want to report on.