0

I need to read from the security log in windows, but the user will not have the administrative permissions to do so, and the application will throw an exception,

EventLog[] a = EventLog.GetEventLogs();

foreach (var item in a)
{
    if (item.Log == "Security")
    {               
        foreach (EventLogEntry item2 in item.Entries)//The exception thrown here
        {
            //TODO
        }
    }
}

I just want to read, I don't want to write anything. How to gain access to these entries without those permissions?

6
  • 2
    I know nothing about it, but I'd be surprised if you could. That's the point of having security levels - the user and their software can only do what they're permitted to do. What do you need out of the security log? It's possible that there's another way to get at the specific information you need. Commented Nov 21, 2012 at 14:00
  • This is most likely a superuser.com question because that is a permissions problem and not a development problem. Commented Nov 21, 2012 at 14:03
  • if it is not a problem, I wouldn't ask :) beside, if there is a way I can change the log settings using .NET code or .bat files my problem will be solved since I can run an application as administrator so I may change everything, if possible of course,, Thanks for help Commented Nov 21, 2012 at 14:24
  • @AbdallahNasir - What do you need to read from the log? Commented Nov 21, 2012 at 15:06
  • @AbdallahNasir - Yeah, that's a good reason. I can't help, but good luck! Commented Nov 23, 2012 at 15:13

1 Answer 1

2

There is a possibility but it requires extensive steps by a qualified Administrator to set up the necessary rights. For more info, see http://blogs.technet.com/b/janelewis/archive/2010/04/30/giving-non-administrators-permission-to-read-event-logs-windows-2003-and-windows-2008.aspx.

If you do not explicitly get rights to read, you cannot -- that is the whole point of DRM.

Sign up to request clarification or add additional context in comments.

1 Comment

To tell the truth, I understood almost nothing from the link, but, my application requires one time run as admin, and I can ensure that, if it is possible to configure the system with the links you gave me using .NET and .bat files I will study the article even if takes a week? so, can we done these steps using .NET code and .bat files :) ? Thanks a lot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.