Read Event Log Remotely with .NET

后端 未结 2 1233
猫巷女王i
猫巷女王i 2020-12-31 15:33

I want to read the Event Log on a remote computer to check for errors during testing. Here\'s some relevant code:

public bool CheckEventLogs(DateTime start)         


        
2条回答
  •  清酒与你
    2020-12-31 16:10

    Thanks to everyone who provided comments on this question. Once I realized that the permissions might not be a part of .NET but part of Windows and the Event Viewer itself, I had some new direction for my own investigations.

    It looks like a "net use" command was all that was needed to establish the connection between my local computer and the remote computer. When calling "net use" before using the code I posted in the question, things worked beautifully. It is simple enough to call that from the code before reading from the event log.

    Thanks again for your help!

提交回复
热议问题