Tag Archives: geek

Managing a NetApp filer from Powershell

Have some NetApps? Want to manage them remotely with Powershell? Upset by the shocking level of documentation? Read on for some common uses:

Connect
If you have your devices domain joined and use a separate account to your desktop login to manage them you’ll need to supply a separate set of credentials:

Connect-NaController -name netapp1 -Credential (Get-Credential) -HTTPS

Create a new volume
Create a new thin provisioned (space reservation=none) volume in an aggregate:

New-NaVol -name testvol1 -Aggregate aggr1 -SpaceReserve none -size 1tb
Create a new QTree, lookup a QTree
Create, manage the option on and lookup a QTree:
New-NaQtree -Path /vol/vol1/homedirs10GBquota01
Set-NaQtree -Path /vol/vol1/homedirs10GBquota01 -OpLocks enabled -SecurityStyle mixed
Get-NAQtree -VolumeName vol1
Create a quota
Add a user quota and lookup quotas set on a QTree. Note the strange syntax for -Volume (it is the volume’s name not full path (/vol/vol1 etc). Also remember that NetApp’s idea of what constitutes a gigabyte is different to everyone else’s so you may want to specify in megabytes instead.
Add-NaQuota -Volume vol1 -Qtree homedirs10GBquota01 -Type user -Target * -DiskLimit 10g
Get-NaQuota -Volume vol1 -Qtree homedirs8GBquota01 -Type user -Target *

Add search paths for auto home shares
List the current paths and add a new one. Important! This command is not additive, you will need to specify any existing paths as well as your new one. This is the same as reading/updating cifs_homedir.cfg

get-nacifshomedirectory
set-nacifshomedirectory -Paths /vol/vol1/qtree1,/vol/vol1/qtree2

Add API access for a restricted subset of users to query a home directory location on the filer
If you want a small set of users to be able to view the location on the filer where it thinks a user’s home directory is, you’ll need to create a custom role with the following API access:

login-http-admin,api-cifs-homedir-paths-get,api-cifs-homedir-path-get-for-user,api-system-get-ontapi-version,api-system-get-version

 

I’ll update with any other useful ones as I find them. I find the cmdlet namespace confusing for NetApp and a lot of commands have different switches for relatively similar things. The API access is also woefully documented.