May 8, 2009

C# - Export Windows Event Logs

Here is a little C# program to export Windows Event Logs. It reads an Event Log and prints entries to STDOUT so you can pipe the output to a file or other application.

using System;
using System.Diagnostics;

class EventLogExporter
    static void Main(string[] args)
        EventLog evtLog = new EventLog("Application");  // Event Log type
        evtLog.MachineName = ".";  // dot is local machine
        foreach (EventLogEntry evtEntry in evtLog.Entries)


Anonymous said...

I'll vote for Powershell in checking out the event log, provided you have the ability to install it.

Get-EventLog –list

More details here:

Anonymous said...

I said "ability" but I should have said "access rights"

ambreen said...

check this too and give it a try