As Technet Gallery is retiring so moving the code to Git Hub. (click below github download link for this script)
This script is extension of below script that can monitor the windows services from remote servers.
Now I have updated it to add a alert if services are not running.
Download and extract the script from above , update alerting parameters.
$alert = “Yes” ###specify NO if you don’t want alerts
$report = “.\report.htm”
$smtphost = “smtp.test.com”
$from1 = “SystemsMonitoring@labtest.com”
$to = “VikasSukhija@labtest.com”
Define variables to get services and servers data(example is in the download)
$EVServerList = Get-Content “.\EvServer.txt”
$EVServicesList = Get-Content “.\EvServices.txt”
$EVJserverList = Get-Content “.\EvJserver.txt”
$EVJservicesList = Get-Content “.\EvJservices.txt”
$EVDAserverList = Get-Content “.\EvDAserver.txt”
$EVDAservicesList = Get-Content “.\EvDAservices.txt”
browse to the end of the script and call the function as below
servicestatus $EVServerList $EVServicesList
servicestatus $EVJserverList $EVJservicesList
servicestatus $EVDAserverList $EVDAservicesList
You can schedule the the script to runevery 15 mins or as per your requirements.(don’t for get to remove the pause statement from the batch file)