Posts

Showing posts from May, 2008

Windows Service monitoring and mail reporting Scripts

Create following two files and modify accordingly as per your requirement. Create a scheduled batch file to execute. File name Service Test.bat Set Location as C:\ --------- c:\ date /t >C:\PortsReport.txt time /t >>C:\PortsReport.txt portQry -n Server name -e 25 >>C:\PortsReport.txt portQry -n Server name -e 110 >>C:\PortsReport.txt portQry -n Server name -e 80 >>C:\PortsReport.txt set /A STATUS = 0For /F " eol=; delims=: tokens=3" %%I in (' Find /I /C "NOT LISTENING"C:\PortsReport.txt') Do Set status=%%I if /I %STATUS% gtr 0 cscript C:\Errormail.vbs ----- File Name ErrorMail.vbs Set Location as C:\ ---- Set objMessage = CreateObject("CDO.Message") objMessage.Subject = "Server Protocol Status Report" objMessage.From = "" objMessage.To = "" objMessage।TextBody = "" objMessage.AddAttachment "C:\PortsReport.txt" objMessage.Configuration.Fields.Item _(" http://schemas.mi