I have a VBScript created by the configuration wizard that returns valuable Event Log information into KACE. However, the TimeWritten field being in UTC is not helpful. I am not familiar enough with VB to work in a conversion easily. Can I get some assistance?

 

strComputer = "."

Set objWMIService = GetObject("winmgmts:" _

    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

 

Set colLoggedEvents = objWMIService.ExecQuery ("Select * from Win32_NTLogEvent " _

     & "Where (LogFile = 'System') and (Type = 'Information') and (EventCode = '6006')")

 

Set fso = CreateObject("Scripting.FileSystemObject")

Const ForReading = 1, ForWriting = 2, ForAppending = 8

Set file = fso.OpenTextFile(WScript.Arguments.Item(0), ForWriting, true)

For Each objEvent in colLoggedEvents

    file.WriteLine("===")

    file.WriteLine("Category: " & objEvent.Category)

    file.WriteLine("Computer Name: " & objEvent.ComputerName)

    file.WriteLine("Event Code: " & objEvent.EventCode)

    file.WriteLine("Message: " & objEvent.Message)

    file.WriteLine("Record Number: " & objEvent.RecordNumber)

    file.WriteLine("Source Name: " & objEvent.SourceName)

    file.WriteLine("Time Written: " & objEvent.TimeWritten)

    file.WriteLine("Event Type: " & objEvent.Type)

    file.WriteLine("User: " & objEvent.User)

Next

file.Close()
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Answers

0

Ask Mr G and he will tell you...

http://technet.microsoft.com/en-us/library/ee156576.aspx

Answered 09/10/2013 by: VBScab
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity