mbedford Posted February 11, 2020 Posted February 11, 2020 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
fordea Posted February 11, 2020 Posted February 11, 2020 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) 1
mbedford Posted February 11, 2020 Author Posted February 11, 2020 Thanks fordea, I actually got to the same conclusion myself about an hour ago, its all working now. Thaks for replying.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now