Using the NetApp PowerShell Toolkit (NPTK) can sometimes be a daunting task. Fortunately, it is pretty intuitive on how to configure most aspects of your storage system. Let’s start by looking at some of the cluster level configuration items that can be managed using the NTPK.

Getting Help

The NetApp Communities: The communities are a great place to get help quickly for any question you might have. I recommend that you use the Microsoft Cloud and Virtualization Discussions board, however the SDK and API board will infrequently have questions as well.You can also send me a message using the NetApp Communities. My username is asulliva, and I’m happy to respond to questions directly through the Communities messaging system.

From the NPTK itself: One of the less known features of the Toolkit is that it has help built in. Yes, you can use the standard Get-Help cmdlet, but there’s a hidden treasure: Show-NcHelp.This cmdlet will generate an HTML version of the cmdlet help and open your default browser to display it.

From here you can dig through the cmdlets and view all of the information you want to know about them quickly and easily.

A Few Basics To Get Started

Now that you have the toolkit and have installed it, it’s time to use it. Let’s look at a couple of basic tasks.

Note: I will be using the cDOT cmdlets, however nearly all of the commands have an equivalent available for 7-mode.

Connecting to a controller
Connecting to your cluster is extremely easy. You can specify the cluster management IP address, or any of the node management IPs as well. If you do not provide credentials as a part of the command invocation, it will prompt for them.

1

2

# connect to the cluster management LIF

Connect-NcController$controllerNameOrIp-Credential(Get-Credential)

Getting Information
Now that we’re connected to the cluster, let’s take a look at some of the information that can be gathered:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

# show cluster information

Get-NcCluster

# show node information

Get-NcNode

# show the number of disks assigned to each controller

Get-NcDisk|%{$_.DiskOwnershipInfo.HomeNodeName}|Group-Object

# show a summary of disk status

Get-NcDisk|%{$_.DiskRaidInfo.ContainerType}|Group-Object

# show failed disks

Get-NcDisk|?{$_.DiskRaidInfo.ContainerType-eq"broken"}

# show root aggregates

Get-NcAggr|?{$_.AggrRaidAttributes.HasLocalRoot-eq$true}

# show volumes which are not SVM root volumes

Get-NcVol|?{$_.VolumeStateAttributes.IsVserverRoot-eq$false}

Onward to Automation

There are a number of “PowerShell Toolkit 101” posts that introduce some of the possibilities. Be sure to read through these other posts:

This doesn’t even begin to scratch the surface of the NetApp PowerShell Toolkit. Anything that can be done from the command line can be done using the toolkit. If you’re interested in seeing specific examples, need help, or just have questions, please let me know in the comments!

A little bit of PowerShell for you today. This function uses the Microsoft Active Directory cmdlets to query Active Directory and recursively list the users that are members. This is handy if you want to know all the users in a group without having to dig down through the groups in the ADUC (Active Directory Users and Computers) interface.

I have tested this on Windows 7, Server 2008, Server 2008 R2, and Server 2012. So long as the Active Directory module is installed (part of the RSAT package) then it should work.

Last week I had the pleasure of presenting to the Atlanta PowerShell User Group. The presentation was available over live meeting, if you missed it the recording can be found below. The scripts used in this presentation can also be downloaded here. Note we had a little problem getting the audio working so fast forward to the 2:00 minute mark.

My NetApp fanboyism is fairly well established at this point. I devoted almost three years to developing a PowerShell module that would teach NetApp how PowerShell worked. To my delight a year ago at TechED they took the storage world by surprise when they shipped an official module. I was then humbled to learn that they had found PoshONTAP, and used it as a blueprint when developing the DataONTAP PowerShell toolkit. This experience taught me a valuable lesson. If you believe in something… just do it… life has a funny way of sorting it all out. I took this philosophy an started anew , and my career ski rocketed. The affirmation of all that work was when NetApp approached me six months ago. At first I didn’t believe it was possible, but after many grueling interviews I started to realize I could do this job. Fast forward two months and I’m all settled in at NetApp, and LOVING it! This place is the google of the storage/IT world. Everywhere you look there is another brilliant engineer, but something was still missing… The PowerShell toolkit had shipped and was doing fantastic, but PowerShell still wasn’t in the forefront of developers writing the tools for a windows administrators. I thought about what I could do, again if you believe in something just do it. Enter PowerGUI.

A while back Kirk had approached me about writting a PowerPack for NetApp, and I always thought it was a great idea. So… I learned, and learned fast. Turns out a PowerPack is fairly simple to author. About a week later I had a working demo to show around internally. I had my position papers worked out, and had the elevator pitch ready. I was going to hit the streets and sell PowerShell using PowerGUI as my catalysis. Then something amazing happened, everyone I showed PowerGUI to loved it! Furthermore they instantly knew the advantage of building a tool on top of PowerShell had. I didn’t have to sell anything the tool simply sold itself. At MMS this year if you stopped by during a lull you would have gotten an early alpha demo of the PowerPack. I gave my boss said demo, and his guidance was clear, SHIP IT! Over the past month with the help of the whole team, we went through the gambit from legal to marketing, but in the end my secret project shipped yesterday. What started out as a sales tool ended up being such a compelling user interface that we just couldn’t keep it to ourselves.

If your a PowerGUI user of just a NetApp customer check out PowerGUI, and the PowerPack, as I think it is quite compelling.

~Glenn

Update: There is a known bug in PowerGUI where the first two objects returned don’t display alias properties, as the DataONTAP Toolkit uses alias’s heavily many object appear to be blank. Kirk’s team know about the issue and are working to fix it.

The 2011 Scripting Games are almost upon us, and I for one am very excited. There will be some modifications made to the games this year. For one this will be the first year that the games will only be in one language. This was done for several resons, but they all boil down to one…. There is simply no reason to not be using PowerShell at this point! As a reformed VBScritper I for one welcome the change.

Another modification is that you will only be allowed to enter in one catagory. There was some heart ache last year, because I participated in every event. This raised the bar so that anyone who wanted to win would have had to produce 20 scripts in 14 days. The other side of the coin was that I was unfairly entering scripts that a true beginer shouldn’t have to compeate against. Both are valid points, and in hind site perhaps entering in both catagories was a poor choice on my behalf. That said, I welcome only participating in a single catagory, as delivering two high quality scripts per day for two weeks was a daunting task, and I was burned out after two weeks.

Another potentialy game changing modification is that the submitions may not be visiable until after the deadline for a given challenge. Again I welcome this change as last years games only had one or two original solutions per event. By making the submitions private until after the deadline every solution will be original. This change by it’s very nature will enable cleaver, and uniqe approaches to a problem. I don’t think cheeting was a problem last year, but instead if you saw a script that used a rare .net object, and that script got 5 starts…. well doesn’t that influence you to use the same rare .net object yourself? Of coarse it does, it’s only human nature to want to deliver the best solution possible.

At the end of the day whether your new to scripting or a seasoned pro I highly encourage you to participate in the games this year. I for one will attempt to defend my title, but there will be stiff competition, and I will be shocked if I can pull off a back to back championship. Oh yeah, and did I mention first prize will land you a free pass to TechEd Atlanta!

Recently I was asked to do a guest post on the illustrious “Hey, Scripting Guy!” blog. I was very happy, and excited by this opportunity, but didn’t know what to write. I kicked it around for a couple days, and still nothing. So I called an old friend and asked him what his pain points were. He informed me that his shop was now operating under a 24×7 operations cycle, and it was impossible to keep his 3000+ workstations patched. With that I had my topic; having worked in these environments before I was acutely aware of the strain they put on the sysadmin to stay compliant. A couple days later I had compiled all the best techniques for detecting if a user was active on his/her PC, and shipped my draft off the scripting guy. This morning Google reader greeted me with my very own post!

I’ve had the pleasure of spending the last several days talking to the development team here at NetApp about the DataONTAP PowerShell Toolkit. As a result we’ve all learned alot, one of the more interesting features they brought to my attention was the credential management solution included with the toolkit. I found this very compelling, you see embedding credentials within a script is as old as scripting itself. There was a time not too long ago when it was considered taboo. However with PowerShell came access to the .net Security.Cryptography encryption/decryption methods. Scripters have unknowingly been accessing said methods indirectly whenever they would use the credential management funcions that Hal amd BSonPosh wrote long ago.

Which brings me to the DataONTAP toolkit. The Development team has steped it up a notch and included a full credential management solution with the latest version of the toolkit. The way it works is first you need to save logon information by using the Add-NaCredential cmdlet to save the credentials for a given NetApp controller onto the local machine. Then the next time you run the Connect-NaController cmdlet the credentials you previously saved will be used. So how do we use this new feature, and why do you care?