PoshOnTap: Manage NetApp SAN from PowerShell Demo

Well it’s the night before VMworld, and I can’t sleep, so I’m catching up on my blog.  A while back I did a presentation to the PowerShell Virtual Users Group.  I demoed my PoshOnTap PowerShell Module, a lot has changed since that presentation.  Mainly I have a new version, but I’m still in the process of trying to get the nod from NetApp.  So in the meantime if you wished you could manage a NetApp SAN from PowerShell go check it out I have the first 30 minutes.  http://marcoshaw.blogspot.com/2009/08/windows-powershell-virtual-user-group.html

With a little luck I’ll get the nod to redistribute the manageontap c# assemblies, and I’ll post Version 2 of my PoshOnTap module!

~Glenn

NetApp
Powershell

Comments (0)

Permalink

10th Powershell virtual usergroup announced

UPDATE: Due to a schedualing conflict the meeting has been moved to Thursday May 7th, 2009 at 8:00PM EST (lucky number 7 should be a good meeting)

Marco announced yesterday that the 10th Powershell Virtual User group will be held on Thursday April 30th, 2009 at 8:00PM EST.  On the schedule will be Bart De Smet (Microsoft), Sergei Anotonov (Microsoft), and Your’s truely!

I will be presenting Managing NetApp via Powershell, and plan on covering the OnTap SDK as well as my own PoshOnTap V2 module.

All the details can be found here

See you there
~Glenn

NetApp
Powershell

Comments (0)

Permalink

Powershell: Passthru Authentication with OnTap SDK 3.5

This morning I decided to play with the passthru authentication via RPC that the SDK provides, and boy is it easy! To utilize passthru authentication you first you need to *install* a dll. Assuming the sdk is saved to C:\

x86
copy “C:\manage-ontap-sdk-3.5\lib\nt\ntapadmin.dll” %windir%\System32\ntapadmin.dll
x64
copy “C:\manage-ontap-sdk-3.5\lib\nt\x64\ntapadmin.dll” %windir%\System32\ntapadmin.dll
copy “C:\manage-ontap-sdk-3.5\lib\nt\ntapadmin.dll” %windir%\SysWOW64\ntapadmin.dll
ia64
copy “C:\manage-ontap-sdk-3.5\lib\nt\ia64\ntapadmin.dll” %windir%\System32\ntapadmin.dll
copy “C:\manage-ontap-sdk-3.5\lib\nt\ntapadmin.dll” %windir%\SysWOW64\ntapadmin.dll

Now that the appropriate DLL is *installed* connecting to a Filer is as simple as specifiying the style as RPC.

#Load the SDK
[void][Reflection.Assembly]::LoadFile('C:\manage-ontap-sdk-3.5\lib\DotNet\ManageOntap.dll')
# Instantiate a new NaServer object specifying our destination filer as 'NetApp', and using OnTAPI 1.0
$NaServer = New-Object Netapp.Manage.NaServer("NetApp",1,0)
#Set the connection style to RPC
$NaServer.Style = "RPC"
#Create our request in this case 'system-get-version'
$NAElement = New-Object NetApp.Manage.NaElement("system-get-version")
#Get the results
$NaServer.InvokeElem($NAElement).GetChildContent("version")
NetApp Release 7.2.5.1: Wed Jun 25 09:03:07 PDT 2008

Similar procedures will enable the SLL/encryption capabilities within the SDK only using the ssleay32.dll(SSL)/libeay32.dll(encryption). I’m not yet sure what the zephyr(ZAPI) assemblies do, but hey I’m just admin living in a devs world.

Enjoy
~Glenn

NetApp
Powershell
VMware

Comments (0)

Permalink

OnTap SDK: Report all Shares and Exports on mixed volumes

This challenge was also thrown down by LucD, he asked for a list of mixed vols and any NFS exports/Cifs shares off the volume.  Well this was a fairly straight forward process. First I would need every NFS export followed shortly by any Cifs shares.   While I could have used my “cli-cheat” for the Cifs shares, I decided to write a function using the proper ZAPI calls.  Finally the volumes… well maybe not, security style is assigned on a Qtree level,  I called an audible…  This script uses my Get-NaCifs , and Get-NaNFSExport scripts which can be found on poshcode.org.

Continue Reading »

NetApp
Powershell

Comments (0)

Permalink

OnTap SDK: Get all Cifs shares with permissions

Task: Get a list of all Cifs shares on a filer, and their permissions.

I’m going cheat a bit and just say that I spent two days searching through the API for this, before I realized that Filerview was echoing out the output from ‘cifs shares’… This changes the task slightly, the end goal is still the same, but the method will be via the cli. I used the same discovery functions as before. Good thing I wrote them because the API I needed is undocumented!

Continue Reading »

NetApp
Powershell

Comments (6)

Permalink

Powershell Reflection OnTap Style

I’ve come to love PowerShells ability to perform reflection on any given object (I.e. Get-Member). The way the OnTap SDK was implemented does not support reflection… directly. The problem is the SDK consists of two classes that are able to interact with the ZAPI interfaces. Basically NaServer holds everything needed to connect->execute-> return results. Likewise the NaElement knows how to take input, and format that input into a valid XML request for ZAPI. NaElement also has all the logic needed to navigate, and use the information returned by a request. So what does that mean to us? Neither object has any knowledge of the actual API! This utterly kills the ability to “feel out” a given object. I can’t (new-object something|gm) till I find what I’m looking for, and I wanted that ability.

That small capability is almost a deal breaker for me. I’ve spent hours upon hours with the API on one monitor, and PowerShell on the other… it’s not fun! I sent out an open call during my last post, and was quickly taken up on it. As I sat down last night, and started digging through the API yet again. I decided enough was enough… I sat down and wrote a couple functions that more or less allow me to perform a primitive version of reflection. More accurately I can search the API reference right there from my console. I was so pleased with the outcome I decided to post a quick how to.

Continue Reading »

NetApp
Powershell

Comments (1)

Permalink

NetApp OnTap SDK 3.5 released with .net support(AKA PowerShell Support)!

Late last night I stumbled upon this post in the NetApp Technology Network (NTN) announcing version 3.5 of the Manage OnTap SDK… My first reaction was that OnTap 7.3.1 might be getting closer to GA, seeing as they finalized the API.  I downloaded the new bits, and was reading through the documentation when I noticed the following:

Supports multiple language interfaces –  C/C++, C#, VB.NET, Java, and Perl

Well that pretty much made my whole PoshOnTap module irrelevant… but it’s still a great source for examples using the SDK.   Speaking of, how about quick intro to the SDK… Continue Reading »

NetApp
Powershell

Comments (4)

Permalink

PoshOnTap: Monitor reconstruction status

Well this morning I had the distinct privilege of loosing two disks… YIKES! Thank’s to Raid_DP my Aggregate is still online, but if I loose another disk I’m done. As this is not a comfortable position to be in I want to know how long it will take; enter PowerShell!

Using my PoshOnTap module I wrote a quick script to monitor the status of a rebuild. Hopefully you’ll never need it!

Continue Reading »

NetApp
Powershell

Comments (0)

Permalink

Powershell: PoshOnTap meet world…

UPDATE: This project has been moved to codeplex, the latest build can be located here.

Okay… well I’ve written enough, and tested what I can… Time to let this baby go and see what happens!   PoshOnTap released!

What is PoshOnTap?  PoshOnTap is a collection of PowerShell V2 Advanced Functions to manage A NetApp Filer from PowerShell.  All in all the project contains 138 cmdlets covering everything from basic disk management to snapvaults and everything in between!

What isn’t PoshOnTap? PoshOnTap is not in anyway affiliated with NetApp… I wrote it, and I’m sure there are bugs!!!  I’ve tried my best to polish it all up, but at the end of the day use with caution…. i.e., if you break your production SAN, I don’t want to hear about it!  Additionally two glaring holes are the lack of cifs/NFS/FC cmdlets… I’ve been writing this for six months, and 20k + lines of code later I still haven’t gotten to them. I decided that if I tried to do it all in one swipe OnTap 8 would be released before I could finish.

The framework is very basic anything can be accomplished with the use of one class and a cmdlet, everything else is a wrapper to ease the administrative experience.

How to use:

1. Download the source files from below, and extract to a location on your local machine.
2. If your running all-signed you’ll need to sign the scripts prior to execution (sorry I can’t afford a code signing cert)
3. from a Powershell V2 CTP3 prompt type: Import-Module <path>\PoshOnTap.psd1

There is a short getting started doc to give you a rough idea, but this is all very raw…  My hope is that the community can pick this up, and bring it all that last mile.  Adam provided the idea with Powershell OnTap, and I hope I’ve provided a base!   I will blog some example uses next week, but in the interim.

Have at it!

~Glenn

UPDATE: this project has been superceeded by it’s big brother PoshOnTap v2 www.codeplex.com/poshontap

Continue Reading »

NetApp
Powershell

Comments (9)

Permalink

PowerShell OnTap Cmdlets: Soooo close!

The good news, I’m almost done with the initial wave of Powershell OnTap cmdlets.  Even better I talked to Adam Weigert the author of the Powershell Ontap API wrapper, and he’s agreed to add my cmdlets to the original project.  The bad news I still have some QA to perform and documentation to complete…  In the interim, a transcript of my PowerShell session this morning!

I had the task of setting up a test LUN so Andrew and I could work on some array based snapshot’s (more to come once we figure it out).  The Names have been changed to protect my customers, but you should be able to get a feel for the cmdlets.

Continue Reading »

NetApp
Powershell

Comments (0)

Permalink