Accepted Solution

toolkit output questions

First, I am very new to PowerShell and the toolkit.

When I use some commandlets in a shell I get blank lines for output.

such as when I put in Get-NaSystemOntapiVersion

Tried piping it to foreach and then assigning the variable I wanted, in this case MajorVersion and MinorVersion but I still get nothing

Obviously I am missing something.

Can someone explain in plain language (as opposed to powershell speak) what that might be ?


Re: toolkit output questions

I figured out the foreach part, but not why it would not list things without using the foreach

Re: toolkit output questions

Could you post an example from importing the module to the Get-NaSystemOntapi cmdlet?  Something like this:

PS C:\> ipmo dataontap

PS C:\> Connect-NaController

Name                 Address           Ontapi   Version

----                 -------           ------   -------      1.13     NetApp Release 8.0.1 7-Mode: Wed Jan  5 17:24:41 PST 2011

PS C:\> Get-NaSystemOntapiVersion

                           MajorVersion                            MinorVersion NodeOntapiDetails

                           ------------                            ------------ -----------------

                                      1                                      13 {fas2040rre1}


Re: toolkit output questions

Hi Eric,

Here is the relevant part of the ps script

Import-module DataOnTap


$cred = "appropriate definition of $cred here"

foreach ($netapp in $NetappList) {   

   Connect-nacontroller -credential $cred $netapp | select Name,Address


}  # End netapplist foreach

When I run these commands from the command line the output is what you show


Re: toolkit output questions

Ahh, so the commands inside the loop don't output text, they return objects directly on the pipeline.  You essentially end up with a list of controller, ontapi version, controller, ontapi version, and so on.   Because you have a select statement in there and multiple types in the output, PowerShell is getting confused and doesn't know how to format the objects.

Instead, one option is to use the Select-Object cmdlet to combine the controller and Ontapi Version into a single object:

$hostnames = @("", "")

foreach ($hostname in $hostnames)


   $cntlr = Connect-NaController $hostname

    Get-NaSystemOntapiVersion |

        select @{Name="Name";Expression={$cntlr.Name}},


               MajorVersion, MinorVersion


which outputs this:

Name                         Address                                        MajorVersion                MinorVersion
----                         -------                                        ------------                ------------                                                     1                          13                                                   1                           7

Of course this example is a bit contrived since the controller object already includes an OntapiVersion property, but it would apply similarly to any other information you gather per controller...

Hope that helps!

Re: toolkit output questions

Ahhhh, I would have thought the select in the connect-nacontroller statement would have only acted on that statement, but after reading your response I see that it apparently does not.  Removing it from the connect statement returns the output I would have thought I would see.

I have a long way to go to understand the PowerShell stuff!