REMOVE / DELETE windows 2003 LOG

hello
Im trying to remove the windows system log using command line...

i can backup the  system log using "dumpel" but i did not find a way
to  remove the log on windows2003.

Any idea ?

thanks
ETSPAAsked:
Who is Participating?
 
tenaj-207Connect With a Mentor Commented:
There is no command line option like dumpel to delete the event logs, but you can use a script.  Microsoft has a couple of canned ones and there are others as well.

http://www.microsoft.com/technet/scriptcenter/scripts/logs/eventlog/default.mspx?mfr=true

or
http://www.dotnetspider.com/resources/23594-Delete-Event-log-VB-NET.aspx
0
 
droydenCommented:
http://technet.microsoft.com/en-us/sysinternals/bb897544.aspx

This will work, its old sysinternals stuff.
0
 
bluntTonyCommented:
Call this vbscript from the command line.

The below example clears the system log on the local machine, defined by 'strLog'. Change as you need to.

HTH
strLog = "System" 
strComputer = "." 
set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set colLogs = objWMI.ExecQuery("Select * from Win32_NTEventlogFile Where " & _
 "Logfilename = '" & strLog & "'")
if colLogs.Count <> 1 then
 WScript.Echo "Fatal error. Number of logs found: " & colLogs.Count
 WScript.Quit
end if
for each objLog in colLogs
 objLog.ClearEventLog
 WScript.Echo strLog & " cleared"
next

Open in new window

0
 
bluntTonyCommented:
Save this as a vbs (e.g. clearlog.vbs), then call from the command line via:

cscript clearlog.vbs

Tony.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.