Microsoft Virtualization Discussions

Issue with Powershell results typing in manually vs runnig within script

JAL
4,294 Views

All,

If I enter the command >Get-NaVol manually in Powershell it list all Volumes on the controller in a chart like view as seen below.

However, if I run the same exact command with a Powershell script (*.ps1).  The results are layed out much differnet as seen in the 2nd example.

Is there a way to run the script to have it display the volume information as in example 1 ?   Thanks for any help.

 

Joe

 

 

Example 1

Name                      State       TotalSize  Used  Available Dedupe  FilesUsed FilesTotal Aggregate
----                      -----       ---------  ----  --------- ------  --------- ---------- ---------
Backup_Vol1        online         4.5 TB   78%  1010.4 GB  True         104        32M aggr1_Sata
Backup_Vol2        online         3.0 TB   49%     1.5 TB  True         104        32M aggr1_Sata
Backup_Vol3        online         5.0 TB   60%     2.0 TB  True         104        32M aggr1_Sata

Example 2

DedupeEnabled                : True
ChecksumStyle                : block
CloneChildren                :
CloneParent                  :
ContainingAggregate          : aggr1
DiskCount                    : 8
FilesTotal                   : 622580
FilesUsed                    : 155
IsChecksumEnabled            : True
IsInconsistent               : False
IsSnaplock                   : False
IsUnrecoverable              : False
MirrorStatus                 : unmirrored
Name                         : testvol
PercentageUsed               : 0
PlexCount                    : 1
Plexes                       : {/aggr1/plex0}
QuotaInit                    : 0
RaidSize                     : 16
RaidStatus                   : raid_dp,sis
Reserve                      : 0
ReserveRequired              : 0
ReserveUsed                  : 0
Sis                          : idle
SizeAvailable                : 17175904256
SizeTotal                    : 17179869184
SizeUsed                     : 3964928
SnaplockType                 :
SpaceReserve                 : volume
SpaceReserveEnabled          : True
State                        : online
Type                         : flex
Uuid                         :cklfdjcpowe-dclnsdnkc=ckda
IsUnrecoverableSpecified     : True
PercentageUsedSpecified      : True
SpaceReserveEnabledSpecified : True

1 ACCEPTED SOLUTION

asulliva
4,256 Views

Have you tried simply piping to Format-Table?

 

$Filer = $(Read-Host -prompt "On which NetApp filer are you creating the LunClone?")
    
Connect-NaController $Filer -credential (Get-Credential) -HTTPS
Get-NaVol | Format-Table
Get-NaLun | Format-Table
If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

View solution in original post

4 REPLIES 4

JGPSHNTAP
4,279 Views

Thats because get-navol uses default templates on the output.xml

 

what's your PS1.. please post it

JAL
4,262 Views

Thanks for the reply.  The script is still being written for what I want it to accomplish but, here are the lines in the script that I'm using currently.

 

    $Filer = $(Read-Host -prompt "On which NetApp filer are you creating the LunClone?")
    
Connect-NaController $Filer -credential (Get-Credential) -HTTPS
Get-NaVol
Get-NaLun

 

My end game is to present the user running the script the table format of the Volumes and Luns on the stated controller to answer the next group of questions the script will ask the user.

What is listed above works fine other than the way it displays the volume and lun information.

 

Thanks,

 

Joe

asulliva
4,257 Views

Have you tried simply piping to Format-Table?

 

$Filer = $(Read-Host -prompt "On which NetApp filer are you creating the LunClone?")
    
Connect-NaController $Filer -credential (Get-Credential) -HTTPS
Get-NaVol | Format-Table
Get-NaLun | Format-Table
If this post resolved your issue, please help others by selecting ACCEPT AS SOLUTION or adding a KUDO.

JAL
4,251 Views

 

 

I'm still learning Powershell and it's syntax and possibilities so, didn't even think to use that cmdlet for the output.

 

Public