Link to home
Start Free TrialLog in
Avatar of ETSPA
ETSPAFlag for Italy

asked on

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
Avatar of droyden
droyden

http://technet.microsoft.com/en-us/sysinternals/bb897544.aspx

This will work, its old sysinternals stuff.
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

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

cscript clearlog.vbs

Tony.
ASKER CERTIFIED SOLUTION
Avatar of tenaj-207
tenaj-207
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial