Microsoft Virtualization Discussions
Microsoft Virtualization Discussions
I'm trying to speed up the process of acquiring the "Created" field on each snapshot returned from get-ncsnapshot. It currently takes many hours to return a generic get-ncsnapshot against a Ontap 9.1P2 cluster with >200K snapshots.
I've tried the following:
$snaptemplate = get-ncsnapshot -Template
get-ncsnapshot -Attributes $snaptemplate
While this does yield significant performance improvements, it doesn't include the "Created" property.
I can't initialize-ncobjectproperty against created as it's an alias for AccessTimeDT. I can't initialize AccessTimeDT as it's read-only as follows:
Initialize-NcObjectProperty -Object $snaptemplate -Name AccessTimeDT
WARNING: Property AccessTimeDT on object is not writable
Name Volume Vserver Created Total Cumulative Dependency
---- ------ ------- ------- ----- ---------- ----------
I need to be able to initialize AccessTimeDT within the $snaptemplate object in order to be able to return the results needed.
$snaptemplate | get-member
TypeName: DataONTAP.C.Types.Snapshot.SnapshotInfo
Name MemberType Definition
---- ---------- ----------
Created AliasProperty Created = AccessTimeDT
Cumulative AliasProperty Cumulative = CumulativeTotal
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Validate Method void Validate()
AccessTime Property System.Object AccessTime {get;set;}
AccessTimeDT Property System.Nullable[datetime] AccessTimeDT {get;}
Anyone have any ideas on how to modify the template to have AccessTimeDT writable so it can be used to speed up get-ncsnapshot?
Thanks...
Solved! See The Solution
I find it easier to use the hash notation for these types of attribute limit examples...
Get-NcSnapshot -Attributes @{ AccessTime = "" }
The AccessTime is turned into a PowerShell DateTime object by PSTK and accessed using hte AccessTimeDT property of the resulting object. That's why it doesn't recognize it when trying to limit the attributes returned.
Hope that helps.
Andrew
The problem is that AccessTimeDT is not a property being returned from ZAPI, but rather is a calculated property coming from the toolkit. You can use your current method but initialize the AccessTime property instead and then calculate the DT property yourself (you can use the cmdlet 'ConvertTo-DateTime -Seconds $_.AccessTime' to calculate the DT property).
I hope this helps.
Jason
Nevermind. What Andrew said. 🙂
I find it easier to use the hash notation for these types of attribute limit examples...
Get-NcSnapshot -Attributes @{ AccessTime = "" }
The AccessTime is turned into a PowerShell DateTime object by PSTK and accessed using hte AccessTimeDT property of the resulting object. That's why it doesn't recognize it when trying to limit the attributes returned.
Hope that helps.
Andrew
That makes sense.
Thanks for your help....