Microsoft Virtualization Discussions

Difference between individual commands and putting them together in a script


Hi all,

When I run the below set of command from the CLI they work as expected. But when I run them in the script I do not get any information. Looking for comments on possible causes....

==On CLI==

PS C:\Users\mrinal\Documents\powershell> $vserver_listing = Get-NcVserver -Template

PS C:\Users\mrinal\Documents\powershell> $vserver_listing.VserverType = "data"

PS C:\Users\mrinal\Documents\powershell> $vserver_list = Get-NcVserver -Query $vserver_listing

PS C:\Users\mrinal\Documents\powershell> $vserver_list

Vserver                   State      VserverType   Comment

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

madden-vs1                running    data

madden-vs2                running    data

mrinal-vs02               running    data

rfl_test                  running    data

upper                     running    data

UPPER                     running    data

vs01                      running    data

vs1                       running    data

vs-esrf                   running    data

==Via ps1 script==

PS C:\Users\mrinal\Documents\powershell> .\vserver_dr_collect.ps1

Cluster Name / IP :

Cluster Admin UserName : admin

Cluster Admin Password : *********

Name                                    Credential                              HostUser

----                                    ----------                              --------                            System.Management.Automation.PSCrede... DOMAIN\dummy

Select Vserver : vs01 <<<<<<< The lines above this are blank on the console as well.




Can you attach the script (or a subset that reproduces the problem)?



Script attached. I worked around the problem by printing each unit of the array with a foreach loop. Appreciate pointers to improve this logic. Or any other part of the script for that matter.

NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

NetApp Insights to Action
I2A Banner