Application Integration

Re: Announcing the release of HPE Nimble Storage PowerShell Toolkit version 2.1.0 & Default Form


Announcing the release of HPE Nimble Storage PowerShell Toolkit version 2.1.0 & Default Formatters

Our latest update to the HPE Nimble Storage PowerShell Toolkit was just posted today to Infosight. The release offers a number of enhancements focused on improving customer satisfaction while also fixing a number of outstanding bugs.

You can download the new module here;

Over the next few days I will be posting a number of articles exploring each of these enhancements.

I will ensure that each of these articles is hotlinked to this master announcement as they are written.

We might as well cover the once of these enhancements now, in this case; Default Formatters.

What is a Default Formatter

When powershell commands are run, what is returned to the screen is not raw text, but instead the textual representation of an object (or collection of objects). As you may suspect, the Nimble Objects that are returned are quick complex and contain a large number of data points. For instance if you run the 'Get-NSVolume -name Test' command using the older toolkit you will see so much information that it rolls off the screen and that is only for a SINGLE object. If you run that command against ALL volumes, you can get hundreds of pages of information posted to the screen. See following screenshot;OldObject.png

To fix this, and make it much more readble, we need to be able to give a hint to the engine that converts objects to screen text representations. Note that we are not changing the object that is returned, but ONLY changing the representation of the object to the screen.

To acomplish this we modified the return object so that it is no longer of type "PSCustomObject', and we now return an object type which matches the API used to make the API call.

As an exampe, for the Volume Command, our TypeName is no longer 'PSCustom' but instead is 'NimbleStorage.Volume.TypeName'. This can be verified by using the command 'Get-NSVolume | get-member' and looking at the first returned line.

Once we have a typename, PowerShell will attempt to find the default formatter file that contains that type name. In this case, we have included a file in the PowerShell Module named 'HPENimblePowerShellToolkit.format.ps1xml'.

Suffice to say that once this automation all connects, the new output will by default display in table format instead of list format, and only the fields identified in the formatter file are displayed by default. An example of the difference can be seen below in a properly formatted output;PropForm.png

But remember that only the screen representation of the object has been modified, not the actual object itself, just because a less importaint field is not displayed doesnt mean it isnt still there. In fact, you can override the default formatter and go back to the old model by using the following addition to your command;

Get-NsVolume | format-list *

This command can also be useful to discover what the list of valid fields are that can be used to create your own custom tables.

It may be tempting to open the formatter file, and modify the XML contents so that you can change the default behavior, assuming that you can read or edit an XML file fluently. This approach while possible however will invalidate the module signature, and depending on your systems security settings may prevent you from loading the module in the future. It is far simpler to simply override the default formatters. To override the default formatter and show the table, but only show the columns that you wish. For example, if you want to only show the Name, Size, Application Category, and the ID of the volumes, you would use the following command;customtable.png


The command shown in the graphic is "Get-NSVolume | Format-Table name,size,app_category,id' but you will notice that I use the shorthand abbreviation for format-table which is 'ft'.

Of course the real advantage here is more than just Volumes but that formatter have been created for the return of all Nimble Storage API types to make all returned objects more easily human readable.

Chris Lionetti

Re: Announcing the release of HPE Nimble Storage PowerShell Toolkit version 2.1.0 & Default Form

Thanks for the updated formatting change.

Do you have a documentation site somewhere? Need to find info on how to create VMware volumes end - to end including attaching and detachoing VMhosts to the Volume, but nowhere is this to be found later that 2016 (and that guide does not work anymore).

Help appreciated.

Occasional Advisor

Re: Announcing the release of HPE Nimble Storage PowerShell Toolkit version 2.1.0 & Default Form

Here is a link to the latest version of the documentation:

HPE Nimble Storage Windows Integration Guide

HPE Nimble Storage documentation on InfoSight




Brian MacDonald
Senior Manager, Global Storage Business Unit
Hewlett Packard Enterprise

Re: Announcing the release of HPE Nimble Storage PowerShell Toolkit version 2.1.0 & Default Form

You are absolutely correct. The documents listed below have been updated for the PowerShell Toolkit 2.1, and also updated to include guidance for Windows Server 2019. These are in editorial review right now, and should be out soon.

Chris Lionetti