none
WMI Win32_NTLogEvent Class - Time Properties Not DateTime?

    Question

  • Hi,

    I've queried an EventLog using ManagementObjectSearcher (System.Management namespace for WMI access).  So far I was able to retrieve log entries by querying the Win32_NTLogEvent instances.

    But when I tried mapping the ManagementObject instances, the TimeGenerated and TimeWritten properties are in String form and not in DateTime type as documented (see MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_ntlogevent.asp).  I can't convert the String directly to DateTime.  A sample value I'm getting is:

    20060907105310.000000+480

    It's the first time I've tried using the System.Management namespace, especially to access Event Logs.  Please let me know if I'm doing something wrong here.  Thanks.

    Thursday, September 07, 2006 4:11 AM

Answers