Microsoft Virtualization Discussions

Powershell scripts verbose output to console

ke_dkropp

Guys, I'm having a newb NetApp powershell problem.  Some commands while run in the powershell window manually output a nice short clean response, however when I try to use the same command in a script I verbose output.  While the data from the verbose output is very useful, I do not need all the info now.  Piping the command to a Select command produces the same result.

 

OUTPUT FROM COMMAND

PS C:\ Get-NaVfiler

Name Status Ipspace VfnetCount VfstoreCount AdminHost
---- ------ ------- ---------- ------------ ---------
XX-XXX-XXX-X01 running default-ipspace 1 2 XXX.XXX.XXX.XXX

 

 

OUTPUT FROM SCRIPT

 

AdminHost : computername
DnsInfo : blah.test
Ipspace : default-ipspace
Name : XXX-XXX-XXX-XXX
NisInfo :
Status : running
Uuid : ef356f0e-2975-11e0-bb7f-00a098270b92
Vfnets : {XX.XX.XX.XX}
Vfstores : {/vol/XXX_XXX_XXX_XXX_ETC}
VfNetCount : 1
VfStoreCount : 1

2 REPLIES 2

billyd

I believe you want to add another pipe and use Format-table.  You can use -autosize to autosize the columns and if columns get cut off you can add -wrap to have the columns wrap to the next line.

 

See example:

 

PS C:\temp\openssh\bin> get-navfiler | select name,status,ipspace,vfnetcount,vfstorecount,adminhost


Name         : vfiler0
Status       : running
Ipspace      : default-ipspace
VfNetCount   : 3
VfStoreCount : 1
AdminHost    :




PS C:\temp\openssh\bin> get-navfiler | select name,status,ipspace,vfnetcount,vfstorecount,adminhost | format-table -autosize -wrap

Name    Status  Ipspace         VfNetCount VfStoreCount AdminHost
----    ------  -------         ---------- ------------ ---------
vfiler0 running default-ipspace          3            1         

vinith

Hello, can you let me know the format you executed the select command ? below example shows how you can selectively filter out parameters using select-object

 

PS C:\Windows\system32> Get-NaVol -Verbose | select name,totalsize,used | fl

Announcements
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.

Public