markneustadt.com

Manually creating an event log source from a command line

When you try to write to the event log, if the event log source doesn’t exist, it’ll fail.  The easiest thing to do (since it’s usually just a one time thing) is to manually create it.

This is from StackOverflow (http://stackoverflow.com/questions/446691/how-to-create-windows-eventlog-source-from-command-line).

eventcreate /ID 1 /L APPLICATION /T INFORMATION  /SO MYEVENTSOURCE /D "My first log"

Of course the “correct” thing to do would be to do it in code.  Check to see if it’s there… if it’s not there, then create it.  Sometimes, you just need to do it though.

 

Scroll To Top