Subscribe
Accepted Solution

Get-NaEfficiency to show list of volumes with snapshots over 20g

Hello good people,

I'm very new to powershell and was hoping someone could help me work out how I can filter the results of the Get-NaEfficiency cmdlet so that it only show the volumes with snapshot size over 20gb. I have tried using the below but with no luck"

Get-NaEfficiency | where {$_.SnapUsage -gt 20000}

Any help would be much appreciated.

Re: Get-NaEfficiency to show list of volumes with snapshots over 20g

Get-Member is your friend:

PS C:\> Get-NaEfficiency | gm

   TypeName: DataONTAP.PowerShell.SDK.Cmdlets.Toolkit.Efficiency.VolEfficiencyInfo

Name                    MemberType Definition

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

Equals                  Method     bool Equals(System.Object obj)

GetHashCode             Method     int GetHashCode()

GetType                 Method     type GetType()

ToString                Method     string ToString()

Allocated               Property   System.Decimal Allocated {get;set;}

Capacity                Property   System.Decimal Capacity {get;set;}

Children                Property   System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=2.0.0.0...

EffectiveUsed           Property   System.Decimal EffectiveUsed {get;set;}

EfficiencyPercentage    Property   System.Int32 EfficiencyPercentage {get;set;}

Free                    Property   System.Decimal Free {get;set;}

Name                    Property   System.String Name {get;set;}

OverProvisioningPercent Property   System.Decimal OverProvisioningPercent {get;set;}

PhysicalUsed            Property   System.Decimal PhysicalUsed {get;set;}

QuotaCommitted          Property   System.Decimal QuotaCommitted {get;set;}

QuotaOvercommit         Property   System.Decimal QuotaOvercommit {get;set;}

QuotaUsed               Property   System.Decimal QuotaUsed {get;set;}

Reserve                 Property   System.Decimal Reserve {get;set;}

ReserveUsed             Property   System.Decimal ReserveUsed {get;set;}

Returns                 Property   DataONTAP.PowerShell.SDK.Cmdlets.Toolkit.Efficiency.ReturnsInfo Returns {get;set;}

SnapUsage               Property   DataONTAP.PowerShell.SDK.Cmdlets.Toolkit.Efficiency.SnapshotUsageInfo SnapUsage {...

SpaceReserve            Property   System.String SpaceReserve {get;set;}

TotalLunSize            Property   System.Decimal TotalLunSize {get;set;}

TotalSize               Property   System.Decimal TotalSize {get;set;}

Used                    Property   System.Decimal Used {get;set;}

So then dig into SnapUsage:

PS C:\> (Get-NaEfficiency testvol3).SnapUsage | gm

   TypeName: DataONTAP.PowerShell.SDK.Cmdlets.Toolkit.Efficiency.SnapshotUsageInfo

Name        MemberType Definition

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

Equals      Method     bool Equals(System.Object obj)

GetHashCode Method     int GetHashCode()

GetType     Method     type GetType()

ToString    Method     string ToString()

Count       Property   System.Int32 Count {get;set;}

Overflow    Property   System.Decimal Overflow {get;set;}

Reserve     Property   System.Decimal Reserve {get;set;}

Used        Property   System.Decimal Used {get;set;}

So then we can use:

PS C:\> Get-NaEfficiency testvol3 | where { $_.SnapUsage.Used -gt 20000 } | ft -AutoSize

Name     Capacity     Used    Free SnapUsage Reserve  Returns EfficiencyPercentage

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

testvol3  16.0 GB 556.3 MB 15.5 GB    5.6 MB       0 556.0 MB                   6%

Re: Get-NaEfficiency to show list of volumes with snapshots over 20g

An how can I retrieve this variable Used        Property   System.Decimal Used {get;set;} to add it to a $??, sow I can print it afterwords.