How can I remove a Windows event log?

During some tests of a C# program that writes into the Event logs I accidentally created an event source "mysb" inside a event log named "mysb" instead of the "Application" event log.

Now I want to get rid of the mistakenly created event source but can't as it has the same name as the event log.

Is there any way to either eliminate source and event log mysb?

As it seems the names differ a bit (I took the names from how they are called from within C#): A source is ".Net Runtime", "Application Error", "Group Policy Files", ... While the protocol is "Application", "Security", ...


You can use the PowerShell command Remove-​Event​Log. According to the description on Microsoft docs:

The Remove-EventLog cmdlet deletes an event log file from a local or remote computer and unregisters all its event sources for the log. You can also use this cmdlet to unregister event sources without deleting any event logs.

(emphasis mine)

The syntax to remove an event log from the local computer is:

Remove-EventLog -LogName "MyLog"

Note: You must run this from an elevated Command Prompt.