{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 TheSansMonoConNormal;}{\f1\fswiss\fcharset0 Arial;}} {\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\ri144\sb160\sl-240\slmult0\f0\fs20\lquote ===========BEGIN CODE================\par \pard\ri144\sl-240\slmult0\rquote ======================================\par '\par ' NAME: VS2005_evtcollect.vbs\par '\par ' AUTHOR: Harley Stagner\tab\tab \par ' DATE : 9/2/2006\par '\par ' COMMENT: This script will query certain servers' event logs for error,\par ' warning, information, success audits, and failure audits. Then,\par ' these events are output in human readable format to 5 html files \par ' based on the event type.\par '\par '=======================================\par '***********************************************************\par '********Header Section*********************************\par '***********************************************************\par \par Option Explicit\par On Error Resume Next \par Dim objWMIService, objFile, objEvent, objFSO, objEmail,objServFile\par Dim logfile_error 'Used for the error html file.\par Dim logfile_warn 'Used for the warning html file.\par Dim logfile_info 'Used for the info html file.\par Dim logfile_success 'Used for the success audit html file.\par Dim logfile_failure 'Used for the failure audit html file.\par Dim intCounter 'Used for iterating through array\par Dim colLoggedEvents 'Used for storing events when queried\par Dim dtDateG, dtTimeG, dtDateW, dtTimeW 'Used for storing converted date,time\par Dim strServer 'Used for storing server name to connect to.\par Dim serverlist 'Used for storing the location of the server list.\par \par '****************************************************************\par '***************Reference Section****************************\par '****************************************************************\par '* In this section I define the html file and the server list file and set \par '* up a constant for reading and for writing to the appropriate files. I\par '* also set up the file system object to write to the logfile_err and read\par '* from the serverlist file.\par '***************************************************************** \par \par logfile_error = "syserrevent.htm"\par logfile_warn = "syswarnevent.htm"\par logfile_info = "sysinfoevent.htm"\par logfile_success = "syssuccevent.htm"\par logfile_failure = "sysfailevent.htm"\par serverlist = "servers.txt"\par \par Const forReading = 1\par Const forWriting = 2\par Const forAppending = 8\par \par Set objFSO = CreateObject("Scripting.FileSystemObject")\par \tab Set objFile = objFSO.CreateTextFile(logfile_error)\par \tab Set objFile = objFSO.CreateTextFile(logfile_warn)\par \tab Set objFile = objFSO.CreateTextFile(logfile_info)\par \tab Set objFile = objFSO.CreateTextFile(logfile_success)\par \tab Set objFile = objFSO.CreateTextFile(logfile_failure)\par \tab\par '**************************************\par '****Worker/Output Section*******\par '**************************************\par '* In this section, I set up the html page, then for each server, I run a\par '* query for error, warning, information, success audit and failure audit \par '* events in all logs. Then, I write this information in a readable format\par '* to the seperate html files(one for each type of event). Finally, I\par '* stamp the end of html file with the time that the script was completed.\par '***************************************\par \par Set objFile = objFSO.OpenTextFile(logfile_error, forWriting)\par \par objFile.WriteLine ("