Jump to content

WMIObject Win32_ReliabilityStabilityMetrics class - Time conversion


Recommended Posts

Posted

Hello,

 

I am using PowerShell to interrogate WMI Class Win32_ReliabilityStabilityMetrics. The "TimeGenerated" field is being returned in a format that I cannot get my head around, the MS documentation suggests it should be DateTime but the result i am getting is "20200211090000.000000-000", any ideas how I can convert to something readable?

 

Thanks

Posted

I'd suggest using Get-CimInstance instead of Get-WmiObject as you'll get the dates back as DateTime objects already so won't need to do any conversion. If you need to use Get-WmiObject then you can use the ManagementDateTimeConverter class:

 

[system.Management.ManagementDateTimeconverter]::ToDateTime($_.TimeGenerated)

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...