Microsoft Virtualization Discussions

Some newbie questions on Controllers, Nodes, object types and filtering out nodes




I am just getting started with PowerShell in general and the NetApp PowerShell toolkit, and I have a couple of newbie questions.

From my first Powershell scripts, I understand that a Clustered ONTAP cluster is referred to as a "(Nc)Controller" and
the nodes as "(Nc)Node".


Given the following connection to a clustered ONTAP system:


$credentials = get-credential
$controller = Connect-NcController –Name na-test-cl1 -Credential $credentials -https

I am confused why these three actions work:


get-ncclusternode | get-ncdisk
get-ncnode | get-ncdisk
get-ncdisk -Controller $controller


while putting the clustername (without using a variablename) on the commandline like this doesn't work "as I would expect":


get-ncdisk -Controller na-test-cl1


get-ncdisk : Incorrect credentials for na-test-cl1.
At line:1 char:1
+ get-ncdisk -Controller na-test-cl1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (na-test-cl1:NcController) [Get-NcDisk], NaAuthException
    + FullyQualifiedErrorId : ApiException,DataONTAP.C.PowerShell.SDK.Cmdlets.Disk.GetNcDisk


More specifically, I get from piping the output of get-ncclusternode and get-ncnode to Get-Member that
they return objects of types DataONTAP.C.Types.Cluster.ClusterNodeInfo and DataONTAP.C.Types.System.NodeDetailsInfo respectively.
$controller is of type NetApp.Ontapi.Filer.C.NcController



How/why does get-ncdisk figure out how to return disk information from three different object types, yet it doesn't understand a literal such as na-test-cl1 ?
So the values passed to "-Controller" and "-NodeName" must always be object instances ?

Lastly, I am trying to achieve the following:

I would like to go over a cluster's nodes and create an excel file per HA pair, containing the shelf info and disk info for that HA pair.
I want an excel file per HA pair in the cluster, not per node.

How do I go about filtering out the HA pair info ?

I can get the nodes in the cluster via:


$nodes = Get-NcclusterNode


And I can get a node's HA partner like this:


$partner = get-ncclusterhapartner -node $node


but what would be the recommended PowerShell way filter out partner nodes to avoid going over both nodes of an HA pair in a cluster when looking up the shelf & disk info ?


(I am coming from a Perl scripting background so I guess getting my head around an object based approach is what's going to be the biggest challenge).


Thanks in advance for answering one or two questions 🙂

Earn Rewards for Your Review!
GPI Review Banner
All Community Forums