ONTAP Discussions

How to Get Top 10 Consumers Via Get-NcQuotaReport

EdS
2,547 Views

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
2,424 Views

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
2,425 Views

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
Public