Requested registry access is not allowed - When accessing Security Logs in Windows
<p>I searched for existing questions concerting this, but they didn't correlate. </p>

<p>I written an application that scans the security event log looking for people trying to hack into the windows server and when discovered. I ban there IP in my firewall automatically. This has worked for years, then all of a sudden I start getting this error.. </p>

<pre><code>Requested registry access is not allowed
</code></pre>

<p>Here's the code</p>

<pre><code>Dim oEventLog As New EventLog(logName:="Security", machineName:=".", source:="Microsoft Windows security auditing.")

For Each oEventLogEntry In oEventLog.Entries 'Error Happens on this line
   'Do Stuff
next
</code></pre>

<p>This runs on a Microsoft Windows Server 2008 R2 Web Edition server, I can use the same code and access events in the application log, just not the security log. I'm not sure what happened, I verified the source hasn't change through change control. I'm assuming a patch was applied that is now causing this condition.</p>

<p>I would like to know how to work around this issue.</p>