8 scripts to help automate repetitive monthly systems maintenance tasks

I know that every system administrator’s job is hard enough so any tool that makes our jobs easier provides value to the business. Instead of spending time on iterative and repetitive tasks, free up your time and put the savings by being proactive. This provides more value for the business.
Here are my top 5 list of scriptable tasks. I use a combination of vbscript, batch script, and free smtp mailer like postie.

1) Daily diskspace checker.
This is my favorite and is done by creating a batch script that returns the result of a DIR command to an output text file. This text file is comma-delimited and is appended to each time the script is run. This text file as input to a chart and emailed to a distribution list. The input text file is read by a Vbscript and formatted into the chart. Here is more information on this http://aminsolutions.com/?p=121.
A second vbscript is used to read another input text file that has a list of servers, disk partitions, disk threshold before an alert is triggered, and a list of emails to send the alert out to.
These two vbscripts allow you to trend on disk growth for proactive management and prevents users from finding out about low disk issues before you do.

2) Daily ping checker.
This is similar to #1 and uses an input text file that includes systems to ping, their IP addresses, who to alert, and a custom message to include in the email body. A vbscript is used to call this input text file and a free smtp mailer like postie to send the alerts.

3) Daily backup checker.
This is similar to #2 and uses combination of a text input file and a vbscript that calls it. The input text file includes a path to the backup logs for that server. It works well for systems that use built-in Windows backup software NTBACKUP.

4) Weekly disk defragment report.
Some of our clients like to see weekly disk defragmentation report of file servers and SQL servers. Using the built-in defrag.exe in a batch script allows us to output the results to a text file and then emailed over to a distribution group.

5) Weekly printer backup.
Another client adds printers to a Terminal server on a consistent basis which necessitated weekly backups. We use the MS PrintMigrator software in a batch script to automated printer backups to nearline. The results are emailed to a distribution group.
6) Monthly restarts.
There is no excuse for not automating this. Windows servers need patches every second Tuesday of the month and requires a restart after that. Putting the servers in a batch script and using the PS Tool psshutdown.exe allows for a forced reboot. This batch script can then be scheduled outside of business hours.

7) Monthly uptime report.
After restarts and patches are applied, it is important to check that they are back online by running the ping checker in #2. I also have an uptime batch script that uses the Windows built-in uptime.exe utility with /s parameter to report on the history of restarts. It shows any BSOD during the month and this is reported via email to a distribution group automatically.

8.) Monthly application service checker.
After a server patch and restart, its important to ensure user and business applications are running. This can be onerous and fortunately, can easily be scripted. Its trivial to check that IIS and web services are up for web seervers and that MS SQL services are up for SQL servers. A separate report is generated and can be sent to business owners or sponsors to tell them their applications are all running after systems maintenance.

If you need some samples of these scripts, please comment here and I can follow up.

Leave a Reply

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