REMOVE / DELETE windows 2003 LOG

Posted on 2009-02-23
Last Modified: 2012-05-06
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 ?

Question by:ETSPA
    LVL 7

    Expert Comment


    This will work, its old sysinternals stuff.
    LVL 27

    Expert Comment

    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.

    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
    end if
    for each objLog in colLogs
     WScript.Echo strLog & " cleared"

    Open in new window

    LVL 27

    Expert Comment

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

    cscript clearlog.vbs

    LVL 15

    Accepted Solution

    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.


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    The HP utility "HP Lights-Out Online Configuration Utility for Windows Server 2003/2008" could be of great use when it comes to remotely configure a HP servers ILO WITHOUT rebooting the server. We would only need to create and run scripts using thi…
    Many of us need to configure DHCP server(s) in their environment. We can do that simply via DHCP console on server or using MMC snap-in on each computer with Administrative Tools installed in a network. But what if we have to configure many DHCP ser…
    This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now