Why use this utility

Making sure the services that are needed to run are actually running.  The key here is knowing what happens while you are out of the office relaxing.

How it works

I test for all services. Sadly I don’t log past states of services, just the current start. Someday, this is the thing I would change on this one. I launch the PowerShell script from the windows scheduler because I don’t like one server directly talk to another server. Then I created a file listing out all servers I want to test.  The script starts by check and logging the status of each service while storing it in an email to be sent.

Here is the sample server name file:

For format here is server <space> instance

Here is the breakdown of the code:

All this code is PowerShell. The first part of the code is to read the config file:

The next part is to test the services, This code test Oracle and SQL

Each service has a block like this one above. The states I am looking for is “Y”, “N” and otherwise resulting in “-”

The email block was gotten from dbatools – the community’s sql powershell module  If you have not used this, please give them a try I have learned a lot from them, this is a must checkout library.

 

Full code “SQLServerStatus.PS1”

The output email is something like this:

These is the primary and beginning of the morning reports

Helping make your databases; fast, reliable, secure, and less downtime. Need help making this happen?

Privacy Preference Center