Erase Event Logs 
Author Message
 Erase Event Logs

Is there any way to erase the event logs using the WSH or WMI that comes
with NT2000?

Thanks,

Arch Willingham



Mon, 16 Sep 2002 03:00:00 GMT  
 Erase Event Logs
Not sure whether MS has implemented that stuff in WMI (WSH doesn't
provide such a feature). The alternative is to write an ActiveX control that
access the log records.

G. Born

check out the WSH Bazaar at:

www.borncity.de

Arch Willingham schrieb in Nachricht ...

Quote:
>Is there any way to erase the event logs using the WSH or WMI that comes
>with NT2000?

>Thanks,

>Arch Willingham



Mon, 16 Sep 2002 03:00:00 GMT  
 Erase Event Logs
Yes it is:

Here is a sample to backup and eras the event log

set LogFileSet =
GetObject("winmgmts:{impersonationLevel=impersonate,(Backup)}").ExecQuery _
("select * from Win32_NTEventLogFile where LogfileName='Application'")

For each Logfile in LogFileSet
 RetVal = LogFile.BackupEventlog("c:\BACKUP.LOG")
 if RetVal = 0 then WScript.Echo "Log Backed Up"
 RetVal = LogFile.ClearEventlog()
 if RetVal = 0 then WScript.Echo "Log Cleared"
Next


Quote:
> Is there any way to erase the event logs using the WSH or WMI that comes
> with NT2000?

> Thanks,

> Arch Willingham



Wed, 18 Sep 2002 03:00:00 GMT  
 Erase Event Logs
Steven:

That worked great! One more question...is there any way to modify the scrip
below to do the same thing to another computer on the network?

Arch Willingham


Quote:
> Yes it is:

> Here is a sample to backup and eras the event log

> set LogFileSet =
> GetObject("winmgmts:{impersonationLevel=impersonate,(Backup)}").ExecQuery
_
> ("select * from Win32_NTEventLogFile where LogfileName='Application'")

> For each Logfile in LogFileSet
>  RetVal = LogFile.BackupEventlog("c:\BACKUP.LOG")
>  if RetVal = 0 then WScript.Echo "Log Backed Up"
>  RetVal = LogFile.ClearEventlog()
>  if RetVal = 0 then WScript.Echo "Log Cleared"
> Next



> > Is there any way to erase the event logs using the WSH or WMI that comes
> > with NT2000?

> > Thanks,

> > Arch Willingham



Fri, 20 Sep 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Logging to system event logs...

2. How-to: Log to NT Event Log

3. How to Retrieve Events For One Day From An Event Log on Windows 2000/NT

4. Write events to the event log ?

5. Accesing events in Event Viewer logs

6. Retrieve Events For One Day from an Event Log

7. Event ID in Event Logs

8. Windows 2000/NT Event log monitoring

9. System event logs

10. Backing up the Event Log to a central location

11. WMI, Reading Event Log Entries is VERY slow!

12. Event logging for VB application using VBScript

 

 
Powered by phpBB® Forum Software