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.

Ben Pilbrow
  • 12,049
Vivek
  • 11
  • That looks like C#, but you should probably make it clear what language you are using. – Ben Pilbrow Dec 06 '11 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 07 '11 at 01:02
  • Guys , Any idea to solve this issue. – Vivek Dec 07 '11 at 08:36

2 Answers2

2

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

sailer
  • 29
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

Lucky Luke
  • 1,654