Question

I currently spend a considerable amount of time copying and pasting event viewer logs into text files and then copying them to a repository on another computer.

Is it possible to automate the saving these event viewer logs between a specified date/time to the computer (so that they can then be copied to the repository).

Ideally, if it's possible, it has to be achieved by C# .NET code.

The purpose of this is for automated tests, which run on Windows Server 2003/2008 machines.

Thank you

Was it helpful?

Solution

EventLog.GetEventLogs will get you the logs, you can then loop throught them and write to a text file. The example here will get you started.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top