Tech ONTAP Articles

The Data ONTAP PowerShell Toolkit

Tech_OnTap
32,702 Views

The Data ONTAP® PowerShell Toolkit forum on the NetApp Community pages has seen a lot of activity since the toolkit was released in June 2010. Because of the high level of interest, Tech OnTap asked John Fullbright of NetApp Professional Services to explain the toolkit for Tech OnTap readers.

In a busy storage environment, there are dozens of tasks to be performed every day. Wouldn't it be great if you had an easy way to automate repetitive tasks?

That's exactly what the Data ONTAP PowerShell Toolkit does for those working in Microsoft® environments. For example, in large-scale virtualized environments, it can be difficult to map all the LUNs used by various virtual machines. One toolkit user, Erick Moore, used the toolkit cmdlets and Visio to create a script with graphical output that maps LUNs to VMs. An example of the output is shown in Figure 1.

Figure 1)
Output from a PowerShell script that uses the Data ONTAP PowerShell Toolkit and Visio to map VMs to storage LUNs.

This is a pretty dramatic example of what the toolkit can accomplish, but you'll be amazed at how much you can accomplish with just a few lines.

In this article, I explain what the Data ONTAP PowerShell Toolkit is, talk about some common use cases, give some tips on developing your own scripts, and provide some pointers to useful resources.

What Is the Data ONTAP PowerShell Toolkit?

Windows® PowerShell is Microsoft's command-line shell and scripting language for system administrators. In PowerShell, administrative tasks are performed by specialized cmdlets (pronounced command-lets).

The Data ONTAP PowerShell Toolkit is a NetApp developed set of cmdlets for Windows PowerShell that encapsulate many of the APIs available in the NetApp Manage ONTAP® Software Developer's Kit. These cmdlets let you tap into the power of NetApp APIs to easily perform a wide variety of NetApp specific tasks from within PowerShell scripts. Over 400 cmdlets are available, covering all aspects of NetApp operation.

You can download the toolkit here (free to Data ONTAP customers and partners).

Common Use Cases

Possible use cases for the Data ONTAP PowerShell Toolkit are almost endless. I'll mention a few of the ideas that have been developed and posted on the NetApp Community forum that I think are of particular interest. A later section has links to resources you can access for more information on these and other use cases.

Automated Provisioning. Provisioning new storage is often a time-consuming task. Using the toolkit you can create scripts that let you connect to a storage system, create aggregates and volumes within those aggregates, and set the appropriate options on each volume.

Monitoring and Managing Snapshot Copies. A common task is to go through all your NetApp storage to see how many Snapshot® copies you've got and how much space each is retaining. Another Snapshot-related task is to periodically remove older Snapshot copies based on time or the number of Snapshot copies you want to keep. PowerShell toolkit scripts can do this work for you.

Thin Provisioning. Thin provisioning can save you a lot of storage capacity. Before you use it, however, you'll want to know how much space you can potentially save, and then you'll want an easy way to enable the thin-provisioning settings on each volume. The forum includes scripts that can help you do both. (You can learn more about thin provisioning in a companion article in this issue of Tech OnTap.)

Mirroring. The Data ONTAP PowerShell Toolkit includes a number of cmdlets to manage NetApp SnapMirror®, including the ability to create mirrors, initiate updates, and break and reverse relationships. Using the available capabilities, you can automate almost any SnapMirror operation.

Tips for Developing Scripts

Windows PowerShell uses pipelined execution similar to bash for simplified scripting. If you're not already familiar with PowerShell, the first thing you want to do is familiarize yourself with it. A variety of Web resources exist, such as Windows PowerShell Basics on the Microsoft TechNet Web site.

Once you've got the basics down, you'll want to learn about the capabilities of the NetApp specific cmdlets in the Data ONTAP PowerShell Toolkit. You can see the list of cmdlets by entering the following at the PowerShell command prompt (with the toolkit installed):

PS C:\> Get-NaHelp

Full details can be viewed by entering:

PS C:\> Show-NaHelp

You can get help on a specific cmdlet by entering either of the following:

PS C:\> Get-Help cmdlet-name

PS C:\> Get-Help  cmdlet-name -full (shows full details)

The help file for each NetApp cmdlet includes at least one real-usage example.

When the Data ONTAP PowerShell Toolkit was launched, I posted a lot of "how to" information on various NetApp topics on the Toolkit forum. If you go to the main forum page and search on "HOWTO" or "fjohn" you'll easily locate these posts.

The great thing about PowerShell scripts-including those that use the Data ONTAP toolkit-is that you almost never have to start writing from scratch. You almost always can find an existing script to use as a starting point. The following section links to a few resources to help you get started.

Resources

Got opinions about Data ONTAP Powershell Toolkit?

Ask questions, exchange ideas, and share your thoughts online in NetApp Communities.

John Fullbright
Professional Services Consultant
NetApp

John is a "resident expert" on Exchange. In 2006, John won a Microsoft Most Valuable Professional Award recognizing his competency in Exchange Server technical communities. Prior to NetApp, John was a rapid response engineer in the Microsoft Global Solutions Support Center. As a member of the Microsoft Rapid On-Site Services team, John was regularly tapped to solve the challenges of premier Microsoft customers. He has also served as an intelligence analyst and IT professional for the U.S. Army.

Explore

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.

Replies

Hi Folks,

The Data ONTAP PowerShell Toolkit version 1.2 has just released, and is available here:  http://communities.netapp.com/docs/DOC-6138

John Fullbright

 

The link to the sample scripts is now broken.

 

Is there an updated location for powershell script samples ?


At your service,

 

Eugene E. Kashpureff, Sr.
Independent NetApp Consultant http://www.linkedin.com/in/eugenekashpureff
Senior NetApp Instructor, IT Learning Solutions http://sg.itls.asia/netapp

 

 

Team, do we have a PowerShell poster from our commands like VMware has for it's POSH CMDlet's... https://blogs.vmware.com/PowerCLI/2018/04/new-release-powercli-poster.html ?

Thanks, for sharing this informative thread. I am glad to thank Mr. Teh_onTap for sharing a handy guide in this forum these guides help me a lot.

Public