ONTAP Discussions

Quota help with powershell

jmboardman
5,950 Views

I am attempting to filter a quota report (get-naquotareport) by quota type.  (I want to return all qtree quotas).

I am running the following and it does not return anything:

get-naquotareport -volume myvolume | where-object {$_.Type -like "tree*"}

or

get-naquotareport -volume myvolume | where-object {$_.Type -like "*tree*"}

Filtering on the qtree name does work, by typing the following:

get-naquotareport -volume myvolume | where-object {$_.Qtree -like "sub*"}

Any ideas?

Thanks

1 ACCEPTED SOLUTION

timothyn
5,950 Views

Somewhat confusingly "Type" is only the column heading for the Format-Table output, but isn't aliased to a property on the actual result object.  You can see the actual properties using "Get-Member":

PS C:\> Get-NaQuotaReport | Get-Member

   TypeName: NetApp.Ontapi.Filer.Quota.QuotaInfo

Name          MemberType Definition                                                

----          ---------- ----------                                                

Equals        Method     bool Equals(System.Object obj)                            

GetHashCode   Method     int GetHashCode()                                         

GetType       Method     type GetType()                                            

ToString      Method     string ToString()                                         

Validate      Method     System.Void Validate()                                    

DiskLimit     Property   string DiskLimit {get;set;}                               

DiskUsed      Property   string DiskUsed {get;set;}                                

FileLimit     Property   string FileLimit {get;set;}                               

FilesUsed     Property   string FilesUsed {get;set;}                               

Qtree         Property   string Qtree {get;set;}                                   

QuotaTarget   Property   string QuotaTarget {get;set;}                             

QuotaType     Property   string QuotaType {get;set;}                               

QuotaUsers    Property   NetApp.Ontapi.Filer.Quota.QuotaUser[] QuotaUsers {get;set;}

SoftDiskLimit Property   string SoftDiskLimit {get;set;}                           

SoftFileLimit Property   string SoftFileLimit {get;set;}                           

Threshold     Property   string Threshold {get;set;}                               

Vfiler        Property   string Vfiler {get;set;}                                  

Volume        Property   string Volume {get;set;}  

In this case, what you want is "QuotaType":

PS C:\> Get-NaQuotaReport | where { $_.QuotaType -like "tree" }

Volume                    Qtree                     Type  Disk Limit  Disk Used File Limit Files Used

------                    -----                     ----  ----------  --------- ---------- ----------

vol0                                                tree     20.0 GB          0        50k          0

vol0                      user1b                    tree     20.0 GB    20.8 MB        50k          3

vol0                      user2                     tree     20.0 GB          0        50k          1

vol0                      svpri                     tree     20.0 GB          0        50k          1

vol2                      qtree2                    tree     50.0 GB          0                     1

In the future, you'll get much faster responses if you use the PowerShell Toolkit Community section.

Cheers!

Eric


View solution in original post

3 REPLIES 3

timothyn
5,951 Views

Somewhat confusingly "Type" is only the column heading for the Format-Table output, but isn't aliased to a property on the actual result object.  You can see the actual properties using "Get-Member":

PS C:\> Get-NaQuotaReport | Get-Member

   TypeName: NetApp.Ontapi.Filer.Quota.QuotaInfo

Name          MemberType Definition                                                

----          ---------- ----------                                                

Equals        Method     bool Equals(System.Object obj)                            

GetHashCode   Method     int GetHashCode()                                         

GetType       Method     type GetType()                                            

ToString      Method     string ToString()                                         

Validate      Method     System.Void Validate()                                    

DiskLimit     Property   string DiskLimit {get;set;}                               

DiskUsed      Property   string DiskUsed {get;set;}                                

FileLimit     Property   string FileLimit {get;set;}                               

FilesUsed     Property   string FilesUsed {get;set;}                               

Qtree         Property   string Qtree {get;set;}                                   

QuotaTarget   Property   string QuotaTarget {get;set;}                             

QuotaType     Property   string QuotaType {get;set;}                               

QuotaUsers    Property   NetApp.Ontapi.Filer.Quota.QuotaUser[] QuotaUsers {get;set;}

SoftDiskLimit Property   string SoftDiskLimit {get;set;}                           

SoftFileLimit Property   string SoftFileLimit {get;set;}                           

Threshold     Property   string Threshold {get;set;}                               

Vfiler        Property   string Vfiler {get;set;}                                  

Volume        Property   string Volume {get;set;}  

In this case, what you want is "QuotaType":

PS C:\> Get-NaQuotaReport | where { $_.QuotaType -like "tree" }

Volume                    Qtree                     Type  Disk Limit  Disk Used File Limit Files Used

------                    -----                     ----  ----------  --------- ---------- ----------

vol0                                                tree     20.0 GB          0        50k          0

vol0                      user1b                    tree     20.0 GB    20.8 MB        50k          3

vol0                      user2                     tree     20.0 GB          0        50k          1

vol0                      svpri                     tree     20.0 GB          0        50k          1

vol2                      qtree2                    tree     50.0 GB          0                     1

In the future, you'll get much faster responses if you use the PowerShell Toolkit Community section.

Cheers!

Eric


jmboardman
5,950 Views

Thank you very much!

timothyn
5,950 Views

You bet!  By the way, in the upcoming toolkit release the columns for this object will now display the actual property names (QuotaType, DiskLimit, DiskUsed, etc) to eliminate any confusion.

Public