Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: WMI Remote Read Windows Update Agent Installer Events in the System Application Event Log EventLog
strComputer = '.' ; dot for the local computer or specify the actual remote computername objSWbemLocator = GetObject(StrCat("winmgmts:{impersonationLevel=impersonate}!\\",strComputer,"\root\cimv2")) objEventSet = objSWbemLocator.ExecQuery("select * from Win32_NTLogEvent where Logfile='System' and SourceName='Windows Update Agent'") count = objEventSet.Count If count == 0 Message("Notice","No Events") objEventSet = 0 objSWbemLocator = 0 Exit EndIf ;Create an array to store all the data ;Columns = RecordNumber,Type,SourceName,Message,TimeWritten,EventCode arrEvents = ArrDimension(count, 6 ) Column = 0 ForEach LogEvent In objEventSet arrEvents[column, 0] = LogEvent.RecordNumber arrEvents[column, 1] = LogEvent.Type arrEvents[column, 2] = LogEvent.SourceName arrEvents[column, 3] = LogEvent.Message DMTF_date = LogEvent.TimeWritten yr = StrSub(DMTF_date,1,4) mnth = StrSub(DMTF_date,5,2) day = StrSub(DMTF_date,7,2) hr = StrSub(DMTF_date,9,2) mins = StrSub(DMTF_date,11,2) secs = StrSub(DMTF_date,13,2) YMDHMS_date = StrCat(yr,":",mnth,":",day,":",hr,":",mins,":",secs) arrEvents[column, 4] = YMDHMS_date arrEvents[column, 5] = LogEvent.EventCode Column = Column + 1 Next objEventSet = 0 objSWbemLocator = 0 ; Write Array out to CSV file ArrayFilePutCSV('D:\temp\appeventlog.csv', arrEvents, ',' ) Exit
Article ID: W18488
Filename: Read Windows Update Agent Events in the System Event Log.txt
File Created: 2010:07:13:13:28:26
Last Updated: 2010:07:13:13:28:26