EventLog.DeleteEventSource
using System;
using System.Diagnostics;
namespace nsEventLogs
{
public class RemSrc
{
static public void Main (string [] args)
{
if (args.Length == 0)
{
Console.WriteLine ("Please enter an event source to remove.");
Console.WriteLine ("Usage: RemSrc [source]");
return;
}
if (EventLog.SourceExists (args[0]))
{
Console.WriteLine ("Deleting event log source " + args[0]);
EventLog.DeleteEventSource (args[0]);
}
}
}
}
Related examples in the same category