简体   繁体   中英

attempted to perform an unauthorized operation in event log of remote machine

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?

在具有远程计算机本地管理员权限的用户下运行代码。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM