Microsoft Virtualization Discussions

Get-NaQuotaReport and sort by DiskUsed

ROBINMALIK

Hi all,

I'm using the latest version of the toolkit (2.0.0) and am having difficulty sorting with any sort of sense, by DiskUsed when using the Get-NaQuotaReport cmdlet.

For example:

Get-NaQuotaReport | Where-Object { $_.QuotaType -eq "tree" } | Sort DiskUsed

This results in a list of entries, with all those having "0" DiskUsed at the top and then (for example):

103.2 MB

1.1 MB

14.0 GB

17.9 MB

261.5 MB

396.0 KB

37.8 GB

Confused?

Trying this doesn't work either:

Get-NaQuotaReport | Where-Object { $_.QuotaType -eq "tree" } | Select QTree,DiskUsed | Sort DiskUsed

Again, all results of 0 first, and then:

108249088

1179648

15029035008

18776064

274227200

Huh? Help much appreciated!

1 ACCEPTED SOLUTION

cknight

PowerShell is sorting the numerical fields alphabetically.  Try this:

Get-NaQuotaReport | Where-Object { $_.QuotaType -eq "tree" } | Sort { [decimal] $_.DiskUsed }

View solution in original post

2 REPLIES 2

cknight

PowerShell is sorting the numerical fields alphabetically.  Try this:

Get-NaQuotaReport | Where-Object { $_.QuotaType -eq "tree" } | Sort { [decimal] $_.DiskUsed }

View solution in original post

ROBINMALIK

Thank you very much!

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.

NetApp Insights to Action
I2A Banner
Public