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!

Recall that process from before.


  1. Always start with a New NaElement for the API.
  2. From here it’s a logic gate,
  • If parameter is a primitive type (string,int,bool) then add with the AddNewChild method.
  • If parameter is a NaType then start another New NaElement, and build that NaType, once complete add your new NaType to the request via the AddChildElement method.
  1. Submit the request via the NaServer object InvokeElem method.

Following that our process should be:

  1. Start with the API New NaElement.
  2. The first parameter is of the arg type since arg isn’t one of the three primitives types create a new NaElement.
  3. Add our commands space delimited into the args array as children to the element.
  4. Add the args NaElement to the API NaElement as a Child Element.
  5. Submit the request.

And the code…
$NaElement = New-Object NetApp.Manage.NaElement(“system-cli”)
$arg = New-Object NetApp.Manage.NaElement(“args”)

The results…

All that left was a little regex to screen scrape, and some comments.

6 thoughts on “OnTap SDK: Get all Cifs shares with permissions”

  1. Hi, thanks for all the great info you’ve been posting about the SDK. I’m already finding it very helpful.

    I’m trying to use the method above to run ‘lun show -m’ on the simulator. I can see the command being triggered on the simulator console (i.e. I get the expected output there), but the string in which I’m capturing ‘cli-output’ is blank. Any clue?


    • Tim,
      Have a look at the LUN and IGroup api’s there full of gold. Lun management is perhaps the best part of ZAPI… I try and use cli as a last resort. Having said that to your question.

      Without looking at your code I would guess your not sending it through one piece at a time. Like so,

      $NaElement = New-Object NetApp.Manage.NaElement("system-cli")
      $arg = New-Object NetApp.Manage.NaElement("args")

      Does that work?

  2. Hi Glenn,

    Thanks for the help. I was doing exactly as you did above, but I still get output happening on on the simulator console, not my powershell window. Maybe it’s a simulator version thing. Never mind, I’ll look into the LUN APIs instead.



  3. Glenn,

    Thanks for the pointer -I was indeed able to sort out my requirements from the LUN APIs. I’ve managed to implement what I was trying to do.




Leave a Reply