Server Status Report V2

This script has been extensively re-worked since the original. My intention was to streamline the code and make the script more robust. There is more error checking too.

I have added three new features to the report page:

Collapsible tables – Each table now has an arrow on the left side of the title. When clicked the table will collapse, displaying only the title. I hope this will help in making the report easier to view. Each table can also be set to collapse automatically when the page is loaded.
Hot-fix Matrix – The previous version simply listed each hot-fix that was installed on each server, one below the other. In situations where there were many servers and many hot-fixes it made the page a bit long and difficult to read. I have changed this to a table which lists all hot-fixes installed across all servers. Then the servers are listed from left to right, displaying the install date of each hot-fix if installed. You can also specify any critical hot-fixes in the INI file, which will be listed at the top of the table. Any servers not having the hot-fix installed will be highlighted with a red background.
CSS styling – I have elected to separate the visual styles into a separate CSS file. Those wishing to customise the look and colour scheme can now easily do so by editing the CSS file. The INI file can also be used to specify an alternative CSS file.

Required Tools
The following command line utilities are required for this script:

DUMPEL.EXE
FINDSTR.EXE
PSINFO.EXE

The following command line utilities are optional for this script:

SMTPSEND.EXE

The Files
This script is made up of three files which are explained briefly below:

SRVSTAT.INI – File containing the general settings for the script. This makes customisations easier.
SRVSTAT.CMD – The primary script. This collects the data and builds the report.
SERVERS.TXT – This file simply contains a list of servers to be interrogated. This is not used if the ‘UseLocal’ setting in the INI file is set to YES.
SRVSTAT.CSS – This is the CSS (Cascading Style Sheet) file used to format the report page. This can be edited or an alternative one can be specified in the INI file.

The Reports
The script generates two reports. It would be worth having a look a them:

The Server Status Report displays the report containing the server status tables. Each of the five tables can be disabled in the INI file if they are not required.
The Archive Page displays a list of previous reports sorted by month.

How It Works
The process of this script is as follows:

First, the script reads the SRVSTAT.INI file and stores all it’s contents as variables (all except the lines starting with a semi-colon). These variables are used to control the behaviour of the script and content of the output.

Next, the script will generate a list of server names if the UseLocal variable is set to YES. This simply does a ‘NET VIEW’ command to extract the names. This can also be altered by setting the variable of AlternateDomain. This does the same thing but lists the servers in a domain other than the one the local machine is in. You can filter the list too by setting the UseFilter variable. With this variable, the NET VIEW output is piped to FIND with the variable as the parameter. If you need a negative filter just put a minus sign in front of the variable (this will use FIND /v instead).

Once the script knows which servers to target, it extracts the information it needs from each, using the PSINFO utility to extract system information and the DUMPEL utility to extract the eventlogs.

All the information is stored in temporary files (under the Temp directory). The script then processes these files to extract the info we want and calculate things like the number of reboots, errors etc. etc. This information is written to a new file called DATA.CSV.

The script then uses the information stored in DATA.CSV and the files from the event logs to build the HTML report. The report is saved in the directory specified in the INI file and copied to the Archive directory underneath that with a date-specific file name. The script then builds the Archive Page based on the contents of the Archive directory.

Lastly, if specified in the INI file, the script will copy the report to a web folder and email it to the nominated email address.

All in all, not a bad script. I use this one wherever I go as it provides me with useful information that is a pain to extract manually, especially on a daily basis.

If you find this script useful, please let me know. I’d love to get some feedback.

Leave a Reply

Your email address will not be published. Required fields are marked *