NetApp Community Update
This site will enter Read Only mode on July 23 as we prepare to move to a new platform. You will still be able to view content, but posting and replying will be temporarily disabled.
We're excited to launch our new Community experience on July 30 and more information will follow soon.
Stay connected during the transition - Join our Discord community today.

Microsoft Virtualization Discussions

Get-NaQuotaReport and sort by DiskUsed

ROBINMALIK
5,236 Views

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
5,237 Views

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
5,238 Views

PowerShell is sorting the numerical fields alphabetically.  Try this:

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

ROBINMALIK
5,237 Views

Thank you very much!

Public