Powershell Email Alerts: Database Ping and Database Status

I needed something that would alert me if a database server was unreachable by the network, as well as watching for the status of all databases.

I was able to come up with the solution in Powershell.  The script will take in a list of servers, and first ping the server.  If the server fails to respond to the ping an email is generated and sent out.  If the database server is reachable then the script will look at the status of each database and generate for each one that is offline.
After you have the script working, you can then schedule it in windows task scheduler and pray it only fires off once in awhile if ever.
Todo:  I’d like to make the email function more modular so that it can be passed a few arguments and executed.

Leave a Reply

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