Microsoft Virtualization Discussions

size in MB/GB

JSHACHER11
11,827 Views

I was trying a script that will show more than 80% on all volumes - the output is in Bytes, how do I get it in GB?

Here is my command:

PS C:\Users\admin> Get-NaVol | select name,Aggregate,used,available,sizetotal | ? { $_.used -gt 80 } | ft -AutoSize

Name                               Aggregate      Used    Available     SizeTotal
----                                      ---------            ----     ---------          ---------
vol1                                 a_sata_1          86  67997564928  502511173632

vol2                                 a_sata_4          88 120586096640  971736350720
vol3                                 a_sata_1          89  42216550400  375809638400
vol4                                 a_sata_1          85  623957016576 4098472542208
vol5                                 sas_2               81 133199093760  692563476480

(....I know I need this somewhere >>>   /1gb )

1 ACCEPTED SOLUTION

vinith
11,827 Views

Hello, You can use hash tables to get this done.

Get-NaVol | select name,Aggregate,used,@{Name="Available(GB)";Expression={[math]::Round([decimal]$_.Available/1gb,0)}},@{Name="SizeTotal(GB)";Expression={[math]::Round([decimal]$_.sizetotal/1gb,0)}} | ? { $_.used -gt 80 } | ft -AutoSize


PS C:\Users\Vinith> Get-NaVol | select name,Aggregate,used,@{Name="Available(GB)";Expression={[math]::Round([decimal]$_.

Available/1gb,0)}},@{Name="SizeTotal(GB)";Expression={[math]::Round([decimal]$_.sizetotal/1gb,0)}} | ? { $_.used -gt 80

} | ft -AutoSize

View solution in original post

12 REPLIES 12
Public