Ying Li at myITforum.com

PowerShell & System Center

Convert WMI time to system datetime

Please take a look at the below code:

PS C:\MyWorkPlace\PS> $pc = get-wmiobject win32_operatingsystem
PS C:\MyWorkPlace\PS> $pc.installdate
20060125222312.000000-300

The date is kind hard to read and that is because WMI uses the date and time formats defined by the Distributed Management Task Force DMTF.org Common Informaton Model (CIM) specification.

There is a .Net class ManagementDateTimeconverter can convert WMI time to system datetime:

PS C:\MyWorkPlace\PS> [System.Management.ManagementDateTimeconverter]::ToDateTime("20060125222312.000000-300")

Wednesday, January 25, 2006 10:23:12 PM

Also the below script can do the same:

http://www.jdhitsolutions.com/resources/scripts/ConvertWMITime.txt

Posted: Jun 06 2007, 02:14 PM by yli628 | with no comments
Filed under:

Comments

No Comments