1

I am trying to read the Windows Security Event log by notification.

Below is sample line of code, but when I run it on Windows 7 with a standard user I get an Exception:

EventLog _eventlog = new EventLog("Security"); //Monitor on the Security events 
_eventlog.EntryWritten += new EntryWrittenEventHandler(OnSecurityEventLogWritten);
_eventlog.EnableRisingEvents = True; // I get an exception at this line with a Windows 7 standard user

I am getting the exception saying Requested Registry is not allowed. I tried adding the user to the Event Log Readers Group but that did not help.

It's important to note that when I run this application with local admin rights it works fine.

My requirement is to get the notification when Windows Security events and written for a standard login user.

3
  • That looks like C#, but you should probably make it clear what language you are using. Dec 6, 2011 at 20:05
  • I am using C# language. As mentioned in above code sample , C# has option to get notification when Security event entry is happened. Only issue is standard user gives exeception. Any idea.
    – Vivek
    Dec 7, 2011 at 1:02
  • Guys , Any idea to solve this issue.
    – Vivek
    Dec 7, 2011 at 8:36

2 Answers 2

2

to read security events on windows 7, add network service account to event log readers group.

1

Adding a user to the "Event Log Readers" group should work, at least according to Microsoft. Did you log the user off and back on? Keep in mind that group membership changes require a user to logon and logoff before it will work.

Please also keep in mind that giving a regular user access to the security event log might open your network up to attacks.

Finally, you should take a look at these articles, they explain how to apply custom permissions to event logs:

http://technet.microsoft.com/en-us/library/cc722385%28WS.10%29.aspx

http://blogs.technet.com/b/janelewis/archive/2010/04/30/giving-non-administrators-permission-to-read-event-logs-windows-2003-and-windows-2008.aspx

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .