When I am executing the following code to the local machine, it works fine:
string eventLogName = "Security";
string sourceName = "BTHUSB";
string machineName = "Venus";
EventLog eventLog;
eventLog = new EventLog();
eventLog.Log = eventLogName;
eventLog.Source = sourceName;
eventLog.MachineName = machineName;
foreach (EventLogEntry e in eventLog.Entries)
{
Console.WriteLine("Entry type :{0}",e.EntryType);
}
When I am executing above code it does not execute it gives an error as:
Attempted to perform an unauthorized operation
How to solve it?