CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2010
    Posts
    1

    Can't access event log for tasks

    // I am trying to access the log file at "Microsoft-Windows-TaskScheduler/Operational" but get an exception

    string logName = "Microsoft-Windows-TaskScheduler/Operational";
    EventLog log1 = new EventLog(logName, "myMachine");

    foreach( EventLogEntry entry in log1.Entries )
    {

    }

    // threw exception: System.InvalidOperationException: The event log 'Microsoft-Windows-TaskScheduler/Operational' on computer 'myMachine' does not exist..

    Does anyone know what I need to do?

  2. #2
    Join Date
    Jun 2008
    Posts
    2,477

    Re: Can't access event log for tasks

    Perhaps you need to call "EventLog.CreateEventSource" if SourceExists returns false. Have you tried that?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured