12 Replies Latest reply: May 28, 2013 8:25 AM by JGPSHNTAP

# size in MB/GB

Currently Being Moderated

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\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 • ###### Re: size in MB/GB Currently Being Moderated sweet! What does the 0 do >>>$_.sizetotal/1gb,0

I've tried with and without the 0 and it gives me the same result

Thanks

• ###### Re: size in MB/GB
Currently Being Moderated

I was trying that for 2 filers with no success - what am I doing wrong?

+++++++++++++++++++++++++++++++++++++

Import-Module Dataontap

$myNetAppUser = "root"$myNetAppArrayPass = "password1"

$myNetAppPass = ConvertTo-SecureString$myNetAppArrayPass -AsPlainText -Force

$myNetappCred = New-Object -TypeName system.Management.Automation.PSCredential -ArgumentList$myNetAppUser,$myNetAppPass$ntapArrays = "filer1","filer2"

function Get-VolOverEighty {

• ###### Re: size in MB/GB
Currently Being Moderated

Joel -

A few things I would do differently.

This is a little easier in my opinion

get-navol | Select Name,Aggregate,Used,@{Name="Available (GB)";E={convertto-formattednumber $_.available Datasize "0.00"}} | ? {$_.used -gt 80} | ft -autosize

But, I would do one more thing.  Have a search for a post I did about filer_report.  It will report on the filers with excel conditional formatting.  Give that a shot

• ###### Re: size in MB/GB
Currently Being Moderated

Actually, this is a little better,

get-navol | ? {$_.used -gt 80} | Select Name,Aggregate,@{Name="Used";E={Convertto-formattednumber$_.used percent}},@{Name="Available (GB)";E={convertto-formattednumber \$_.available Datasize "0.00"}} | ft -autosize

You should always pipe in your where clause before you do any sorting.. Selecting...

• ###### Re: size in MB/GB
Currently Being Moderated

Cheers!

I'll give this and the filer_report a spin soon and let you know

BTW, the filer_report script looks awesome

Joel

• ###### Re: size in MB/GB
Currently Being Moderated

Enjoy

#### More Like This

• Retrieving data ...