Converting WMI Dates in real Dates

rated by 0 users
This post has 0 Replies | 1 Follower

Top 10 Contributor
Posts 209
Microsoft MVP
Top Contributor
Tobias Weltner Posted: 12-05-2008 11:10 AM

Ever wondered how to convert the WMI datetime format into a readable date?

Here is an example:

The [System.Management.ManagementDateTimeConverter] type has a static method called toDateTime() which converts WMI datetime to real datetime. The type has additional methods to also convert dates to WMI dates.

$id = Read-Host "Event-ID (i.e. 1001)"
get-wmiobject Win32_NTLogEvent -filter "LogFile='Application' and EventCode=$id" |
Format-Table Computername,
{[System.Management.ManagementDateTimeConverter]::ToDateTime($_.TimeWritten) } ,
Eventtype, Message

 

Page 1 of 1 (1 items) | RSS
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.