ONTAP Discussions

How to Get Top 10 Consumers Via Get-NcQuotaReport

EdS

We would like to create a report that gives us the top X consumers of storage space on our volumes.  We can get a list of the users and their space used via Get-NcQuotaReport | select QuotaUsers,DiskUsed.  However, the number in the DiskUsed field is left aligned so it does not sort well. We can use a Format-Table to right-align the numbers, but we get an error if we try and sort after the formatting is done. How can we get the disk used right-aligned so we can sort on it?

 

function Get-Usage{

Get-NcQuotaReport | select QuotaUsers,DiskUsed | format-table QuotaUsers,@{n='Bytes';e={$_.DiskUsed};align='right'}
}

Get-Usage | Sort-Object -Property Bytes

 

out-lineoutput : The object of type

"Microsoft.PowerShell.Commands.Internal.Format.FormatEntryData" is not valid
or not in the correct sequence. This is likely caused by a user-specified
"format-*" command which is conflicting with the default formatting.
+ CategoryInfo : InvalidData: (:) [out-lineoutput], InvalidOperat
ionException
+ FullyQualifiedErrorId : ConsoleLineOutputOutOfSequencePacket,Microsoft.P
owerShell.Commands.OutLineOutputCommand

1 ACCEPTED SOLUTION

GidonMarcus

Hi

 

why do you don't do the sort before the format table ?

 

Gidi

Gidi Marcus (Linkedin) - Storage and Microsoft technologies consultant - Hydro IT LTD - UK

View solution in original post

1 REPLY 1

GidonMarcus

Hi

 

why do you don't do the sort before the format table ?

 

Gidi

Gidi Marcus (Linkedin) - Storage and Microsoft technologies consultant - Hydro IT LTD - UK

View solution in original post

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