2.del_eventlog.vbs
-------------------------------------源代碼-----------------------------------------------------------
'刪除Evenlog
strComputer= "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Backup)}!\\" & _
strComputer & "\root\cimv2")
dim mylogs(3)
mylogs(1)="application"
mylogs(2)="system"
mylogs(3)="security"
for Each logs in mylogs
Set colLogFiles=objWMIService.ExecQuery _
("Select * from Win32_NTEventLogFile where LogFileName='"&logs&"'")
For Each objLogfile in colLogFiles
objLogFile.ClearEventLog()
Next
Next
---------------------------------------------------------------------------------------------------------
說明:
代碼不包含上下二條虛線喔!這支是清空系統eventlog的wsh編程 scripts,這裡就不多做介紹了,有興趣可以到微軟的腳本範例網站看看,上面有對wsh的做很多的介紹也有範例檔可下來研究! http://www.microsoft.com/china/technet/community/scriptcenter/default.mspx
2.del_eventlog.vbs
-------------------------------------源代码-----------------------------------------------------------
'删除Evenlog
strComputer= "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Backup)}!\\" & _
strComputer & "\root\cimv2")
dim mylogs(3)
mylogs(1)="application"
mylogs(2)="system"
mylogs(3)="security"
for Each logs in mylogs
Set colLogFiles=objWMIService.ExecQuery _
("Select * from Win32_NTEventLogFile where LogFileName='"&logs&"'")
For Each objLogfile in colLogFiles
objLogFile.ClearEventLog()
Next
Next
---------------------------------------------------------------------------------------------------------
说明:
代码不包含上下二条虚线喔!这支是清空系统eventlog的wsh编程 scripts,这里就不多做介绍了,有兴趣可以到微软的脚本范例网站看看,上面有对wsh的做很多的介绍也有范例档可下来研究! http://www.microsoft.com/china/t ... center/default.mspx