/build/static/layout/Breadcrumb_cap_w.png

Scripting Question


Event Log Reporter date/time convert from UTC

09/09/2013 4006 views

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


All 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

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ