Cloud Articles and Resources

Data ONTAP PowerShell Toolkit - HOWTO: Automate Provisioning


You can use the Data ONTAP PowerShell Toolkit to automate many administrative tasks.  In this example, I provision an ONTAP simulator:

Import-module DataONTAP

$SIM1=Connect-NaController SIM1


set-naoption wafl.optimize_write_once off

New-NaAggr aggr1 -DiskCount 8

do { $aggr; $aggr=get-naaggr aggr1} until ($aggr.State -eq "online")

Set-NaSnapshotReserve aggr1 0 -Aggregate

foreach ($VOL in @("vol1", "vol2", "vol3", "vol4"))


                New-NaVol $VOL aggr1 1g

                set-navoloption $VOL nosnap on

                set-navoloption $VOL no_atime_update yes

                set-navoloption $VOL fractional_reserve 0

                set-nasnapshotreserve  $VOL 0

                set-nasnapshotschedule $VOL -Weeks 0 -Days 0 -Hours 0

                get-nasnapshot $VOL | remove-nasnapshot



First, I connect to the filer.  Connections in the toolkit are transitive, so I don't need to specify the filer again unless I want to start woking with a different one (you can work with more than one at the same time in your scripts).  Next, I add some licenses.  I then set a WAFL option.  After that I create an aggregate.  I then loop waiting for the newly created aggregate to come online.

At that point I remove the aggregate snapshot reserve and proceed to my foreach statement.  In the foreach statement, I create four volumes and set various options and schedules.  Last but not least, I enable iSCSI.  It take about a minute for the script to complete.


Please Note:

All content posted on the NetApp Community is publicly searchable and viewable. Participation in the NetApp Community is voluntary.

In accordance with our Code of Conduct and Community Terms of Use, DO NOT post or attach the following:

  • Software files (compressed or uncompressed)
  • Files that require an End User License Agreement (EULA)
  • Confidential information
  • Personal data you do not want publicly available
  • Another’s personally identifiable information (PII)
  • Copyrighted materials without the permission of the copyright owner

Continued non-compliance may result in NetApp Community account restrictions or termination.

All Community Forums