test.vbs- '查看指定登录类型的事件日志
- strComputer = "."
-
- Set wbemServices = Getobject("winmgmts:\\" & strComputer)
- Set wbemObjectSet = wbemServices.InstancesOf("Win32_NTLogEvent")
-
- For Each wbemObject In wbemObjectSet
- If wbemObject.EventCode = "528" And InStr(wbemObject.Message,"登录类型: 2") Then
- WScript.Echo "Log File: " & wbemObject.LogFile & vbCrLf & _
- "Record Number: " & wbemObject.RecordNumber & vbCrLf & _
- "Type: " & wbemObject.Type & vbCrLf & _
- "Time Generated: " & wbemObject.TimeGenerated & vbCrLf & _
- "Source: " & wbemObject.SourceName & vbCrLf & _
- "Category: " & wbemObject.Category & vbCrLf & _
- "Category String: " & wbemObject.CategoryString & vbCrLf & _
- "Event: " & wbemObject.EventCode & vbCrLf & _
- "User: " & wbemObject.User & vbCrLf & _
- "Computer: " & wbemObject.ComputerName & vbCrLf & _
- "Message: " & wbemObject.Message & vbCrLf
- End If
- Next
复制代码
|