How to create Windows EventLog source from command line?

command-line, event-log, windows

Solution

Try "eventcreate.exe"

An example:

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

This will create a new event source named `MYEVENTSOURCE` under `APPLICATION` event log as `INFORMATION` event type.

I think this utility is included only from XP onwards.

Further reading

Windows IT Pro: JSI Tip 5487. Windows XP includes the EventCreate utility for creating custom events.

Type `eventcreate /?` in CMD prompt

Microsoft TechNet: Windows Command-Line Reference: Eventcreate

SS64: Windows Command-Line Reference: Eventcreate

Problem

I'm creating an ASP.NET application that will log some stuff to Windows EventLog. To do this an event source has to be created first. This requires administrative priviledges so I cannot do it in the ASP.NET app. Is there an existing command-line application that is bundled with Windows that can create an event log source, or must I roll out my own?

Original source