Search code examples
windowssecuritylogginguacdiagnostics

How can I create an event source without elevating privileges?


I'm working on a C# program that will be used as a logon script. For diagnostic purposes, I would like to be able to write to the Application log. Unfortunately, all of the documentation that I've found states that it's impossible to create an event source without querying the Security log, which requires privilege elevation; this is obviously a no-go for a logon script.

Is there any way for me to create an event source without this elevation request? Alternatively, is there another location, or preexisting event source, that it might make more sense for me to use for logging purposes?


Solution

  • I don't think you can without elevation. There maybe some permissions you can change in the registry to allow you to, but that would need elevation, catch 22.

    However there is nothing wrong with logging to a text file. As long as whoever is using the program knows this is where the logs will be then a text file will work just as well.