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.

Get all Qtree’s and report any Exports/Shares hung off of them.

As a rule, I return as much information as possible. The way I see it you can always trim it down with Where-Object/Select-Object later.  This script is no different… the hard part turned out getting it to perform!  I had to cut every corner I knew to get results I could live with.  One such trick was letting Group-Object do *most* of the work.   By letting Group-Object handle the matching, Where-Object had less data to filter, and performance jumped. Using Select-Object to “re inflate” the collapsed objects once I found a match. I tried several techniques ranging from hashtables to custom objects in the end nothing was faster than Group-Object.

Finally the results,

I Almost have the iscsi to lun mapping working, the hard part is proving to be the WMI class the MS ISCSI initiator presents. NetApp stuff is simple!

1 thought on “OnTap SDK: Report all Shares and Exports on mixed volumes”

  1. Where might those scripts be? I see the powershell toolkit now has cmdlets labeled the same (get-nanfsexport and get-nacifs). However, postcode.org no longer gives a return on a DNS query…


Leave a Reply