Conversion dates WMI size
How to convert a date in WMI format deviation [datetime] and vice-versa
Let me tell you how we can convert these dates when WMI queries that return a date.
The date format used by WMI is the standardized DMTF size.PS> (Get-WmiObject-class Cim_OperatingSystem).InstallDate 20080618021130.000000 +120The result is a relatively easy to interpret dates. We can easily cut into small pieces and reformat a date in a expected format in PowerShell.
Here dotnet framework class come and rescue you System.Management.ManagementDateTimeConverter. Class does includes ToDateTime and methodPS> $ DateInstallation = (Get-WmiObject-class Cim_OperatingSystem). InstallDate PS> [System.Management.ManagementDateTimeConverter] :: ToDateTime ($ DateInstallation) Wednesday, Jun 18, 2008 2:11:30 a.m.
How to get current datetimePS> $ DateHeureCourante = Get-Date
Powershell Tutorial Online