C
C#17mo ago
Eistee

✅ When and how should I use the Windows EventLog?

Hello, do I need to create proper source via EventLog.CreateEventSource? If I need to, what is the proper way to create this source if the application has no setup and should run without elevated rights? I could imagine to add another executable, which only registers the source, that you can get those from the actual program with System.Diagnostics.Process.Start and startInfo.Verb = "runas"; Do you have an opinion on this or can you give me some tips?
3 Replies
lycian
lycian17mo ago
that's one way, or you can have the application itself check for the existence of the log and ask to rerun elevated to create if needed. Either way will end up with a UAC prompt for the user If you end up launching a separate process/executable, you can always just add requestedExecutionLevel to the app manifest so it always requires to be run as admin
Accord
Accord17mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Eistee
Eistee17mo ago
Thank you! @ryzngard I'll give it a try like this!