System.DateTime Objects in Powershell/PowerCLI
Just something cool I learned while listening to a technet webcast featuring Sean Kearney (aka the energized tech) working w/ DateTime objects. In particular, I was messing w/ pruning vm datastore statistical data.
Example: Wanted to gather an average disk usage metric from vm’s on a particular datastore, but only for the weekdays between 8 and 5.
Let me tell you, it was awesome finding out the get-stat cmdlet pulls date/time properties back as proper datetime objects. Thanks again Sean!
[Update: FYI for those who want to know how I determined properties of the timestamp object. Simply run the script up to step 5, then type $VMStats.timestamp | get-member]