EventLog.DeleteEventSource : EventLog « System.Diagnostics « C# / C Sharp by API






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

1.new EventLog()
2.EventLog.CreateEventSource
3.EventLog.Delete
4.EventLog.Entries
5.EventLog.Log
6.EventLog.Source
7.EventLog.SourceExists
8.EventLog.WriteEntry