Imports System
Imports System.Management
Module Module1
Public Sub Main()
Dim strComputer = "."
Dim objWMIService, objLogFiles, objLogFile, logs, mylogs( 3)
objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate,(Backup)}!\\" & strComputer & "\root\cimv2")
mylogs(1) = "application"
mylogs(2) = "system"
mylogs(3) = "security"
For Each logs In mylogs
objLogFiles = objWMIService.ExecQuery("Select * from Win32_NTEventLogFile where LogFileName='" & logs & "'")
For Each objLogFile In objLogFiles
objLogFile.ClearEventLog()
Next
Next
End Sub
End Module
没有评论:
发表评论