NetApp PowerShell Toolkit – Templates

There’s one particular part of the NetApp PowerShell Toolkit which is not frequently used, but is extremely powerful. Templates can be created for many of the object types which are used to create a query for specific objects, or for limiting the amount of information returned from a particular cmdlet invocation.

To get started, we first need to initialize the object for our query or attribute limiting template. To do this we use the -Template parameter to our cmdlet.

If we were to look at this object it is empty:

netapp_powershell_templates_5

Many of the properties associated with an object, such as an aggregate, volume, or LUN, are objects themselves. If we want to use a property of a child object as the query filter then we need to initialize that property in the template object.

Our template object now has a property object which has been populated:

netapp_powershell_templates_6

At this point we’re ready to use the template, let’s look at how to use it as a query or to limit the attributes returned.

Read more