Microsoft Virtualization Discussions

Get-NaQuotaReport : .QuotaUsers => Cannot index into a null array

storagedp

Hello,

I'm trying to generate some reports of quota usage using function Get-NaQuotaReport. I would like to generate the same output as "quota report -x" command.

It works perfectly with an ONTAP system 7.x system but I get an error message on 8.x system (tested on 8.0.2P3 with Toolkit 1.7 + PS 2.0) indicating that QuotaUsers array is null when the current quota object correspond to a "Tree" or a default user quota (* user@/vol/...).

No problem with "User"quotas, QuotaUsers return a valid array for them

Cannot index into a null array.

At line:1 char:51

+ Get-NaQuotaReport | ForEach-Object {$_.QuotaUsers[ <<<< 0].QuotaUserId}

    + CategoryInfo          : InvalidOperation: (0:Int32) [], RuntimeException

    + FullyQualifiedErrorId : NullArray

Command used to reproduce the problem : Get-NaQuotaReport | ForEach-Object {$_.QuotaUsers[0].QuotaUserId}

Regards,

1 REPLY 1

cknight

Data ONTAP doesn't always return the QuotaUsers field.  So you should check that QuotaUsers is present before using it.

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