发行Windows 7上标准用户的EventLog条目

我正在尝试通过通知阅读Windows安全事件日志。

下面是示例代码行,但是当我用标准用户在Windows 7上运行它时,我得到一个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 

我收到exception说Requested Registry is not allowed 。 我试图将用户添加到事件日志读取器组,但是没有帮助。

请注意,当我使用本地pipe理员权限运行此应用程序时,它工作正常。

我的要求是获取Windows安全事件和为标准login用户编写的通知。

在Windows 7上阅读安全事件,将networking服务帐户添加到事件日志读取器组。

将用户添加到“事件日志读取器”组应该工作,至less根据Microsoft。 你把用户关了又login了吗? 请记住,组成员身份更改需要用户login和注销才能使用。

另请注意,授予常规用户对安全事件日志的访问权限可能会使您的networking受到攻击。

最后,你应该看看这些文章,他们解释了如何将自定义权限应用于事件日志:

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