Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am developing an application that creates Windows event logs and writes to them.

However, during development and testing, I created some event logs by mistake, with sources registered to them.

The issue is that only the first 8 characters of the event log name are significant. Now that I have logs with incorrect names, I cannot create the new logs that I need.

Is there any way to totally remove these event logs (and not just clear them)?

I have tried to delete the file C:\Windows\System32\winevt\Logs\WrongNamedEventLog.evtx, but with no success.

share|improve this question
any final solution with full source code sample? maybe C# and Powershell and/or BAT-CMD scripts? – Kiquenet Jun 5 '14 at 6:47
@Kiquenet See Powershell example in my answer, updated – Mathias R. Jessen Jan 7 '15 at 13:15
up vote 9 down vote accepted

Do it programmatically, like this (C#):


You don't have to compile a C# application to do it though, just invoke the Delete(string logname) method from PowerShell if you like:

share|improve this answer
Thanks. There no other way, to just delete it somehow from Windows Administrator UI? – bzamfir Mar 12 '12 at 7:40
Not AFAIK. Probably to avoid any accidental deletion of logfiles – Mathias R. Jessen Mar 12 '12 at 8:04

I haven't tested this, but if I was in your case...
Use regedit to browse this path, and delete your custom bogus logs:
Then delete the corresponding files from:

share|improve this answer
Thanks. I'll test. However, it would be nice if reboot wasn't involved... :) – bzamfir Mar 14 '12 at 15:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.