Advertisement
Advertisement
| 07.22.2008 at 03:15PM PDT, ID: 23586812 |
|
[x]
Attachment Details
|
||
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: |
On Error Resume Next
Set EventLog = GetObject("winmgmts:{impersonationlevel=impersonate}").ExecQuery("select * from Win32_NTLogEvent")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set txt = FSO.CreateTextFile("C:\Scriptfiles\vbs\text.txt", True)
For each Entry in EventLog
If Len(Entry.Message) > 0 Then
For x = 1 to Len(Entry.Message)
Char = Mid(Entry.Message,x,1)
If Asc(Char) = 10 Then
MSG = MSG & " "
ElseIf Asc(Char) <> 13 Then
MSG = MSG & Char
End If
Next
EDate = Mid(Entry.TimeGenerated,5,2) & "/" & _
Mid(Entry.TimeGenerated,7,2) & "/" & _
Mid(Entry.TimeGenerated,1,4)
ETime = Mid(Entry.TimeGenerated,9,2) & ":" & _
Mid(Entry.TimeGenerated,11,2) & ":" & _
Mid(Entry.TimeGenerated,13,2)
ETime = FormatDateTime(ETime,3)
If IsNull(Entry.User) Then
User = "N/A"
Else
User = Entry.User
End If
If IsNull(Entry.CategoryString) Then
Category = "none"
Else
Category =Entry.CategoryString
End If
EVT = Entry.LogFile & VBtab & _
Entry.Type & VBtab & _
EDate & VBtab & _
ETime & VBTab & _
Entry.SourceName & VBtab & _
Category & VBtab & _
Entry.EventCode & VBtab & _
User & VBtab & _
Entry.ComputerName & VBtab & _
MSG
txt.writeline EVT
EVT = Null
Char = Null
MSG = Null
End If
Next
txt.close
Wscript.echo "Done"
|