Microsoft Virtualization Discussions

Get-NaQuotaReport returning QuotaUsers: {DataONTAP.Types.Quota.QuotaUser}

MARTINLEGGATT
4,149 Views

Hi,

I'm attempting to create a PS script to email Admins when users are over their soft quota. The command I am using in the script is:

$list = Get-NaQuotaReport | where {$_.QuotaType -like "user" -and $_.Qtree -like "unixhome" -and $_.DiskUsed -ne 0} |  select *

This returns what I need but it also returns entries with  "QuotaUsers    : {DataONTAP.Types.Quota.QuotaUser}":

DiskLimit     : -

DiskUsed      : 2380992512

FileLimit     : -

FilesUsed     : 7246

Qtree         : home

QuotaTarget   :

QuotaType     : user

QuotaUsers    : {DataONTAP.Types.Quota.QuotaUser}

SoftDiskLimit : 5242880000

SoftFileLimit : -

Threshold     : -

Vfiler        : vFiler1

Volume        : vol1

I tried amending the command to filter null entries as I read Get-NaQuotaReport doesn't always return a value:

Get-NaQuotaReport | where {$_.QuotaType -like "user" -and $_.Qtree -like "unixhome" -and $_.DiskUsed -ne 0 -and $_.QuotaUsers -ne $null } |  select *

but it still returns these entries.

I'm fairly new to Powershell so have probably missed something simple.

Thanks

Martin

3 REPLIES 3

JSHACHER11
4,149 Views

Hi Martin,

Welcome. I'm also fairly new to Powershell

Did you try this:

$list = Get-NaQuotaReport | where {$_.QuotaType -like "user" -and $_.Qtree -like "unixhome" -and $_.DiskUsed -ne 0} |  select DiskUsed, FilesUsed, Qtree, QuotaType, SoftDiskLimit, Vfiler,
Volume | fl

JGPSHNTAP
4,149 Views

I'm all for scripting, but Oncommand Core should handle this pretty good if I recall.

markweber
4,149 Views

this is what i use in my script:

$q = get-naquotareport

foreach ($user in $q | where -filterscript {$_.quotausers.gettype.name -eq 'GetType'}){...}

i dump the output to a SQL DB for reporting and lookups from our self service tools

oncommand core can do quota alerts via email, but it does choke when you reach a certain amount of quota entries. i'm not sure what that value is, but we have over 100,000 entries in our home directories and oncommand became useless for monitoring quotas quite awhile ago.

Public