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:
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.
use the management dateTime converter:
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site.
Would you like to participate?