VB Script to Monitor Windows Process
Monitoring a Windows process is different from service monitoring. I was using IPSentry to monitor few of my websites, but the IPSentry applications was crashing without my knowledge and thus leaving the websites with no monitoring. So I setup a Windows schedule task with the following VB script to monitor the IPsentry process on every 5 minutes.
The script identify IPSentry.exe process availability and sent email if incase the process was not running. So I can know at what time the process was crashed and even I can restart the application.
Set email = CreateObject(“CDO.Message”)
strComputer = “.”
Set objWMIService = GetObject(“winmgmts:” _
& “{impersonationLevel=impersonate}!\\” & strComputer & “\root\cimv2″)
Set colProcesses = objWMIService.ExecQuery _
(“Select * from Win32_Process Where Name = ‘IPSentry.exe'”)
If colProcesses.Count = 0 Then
email.Subject = “IPSentry DOWN”
email.From = “alerts @techiesweb.com”
email.To = “monitoring @techiesweb.com”
email.TextBody = “IPSentry process is NOT running. Immediately start the application to avoid any further problems.”
email.Configuration.Fields.Item(“http://schemas.microsoft.com/cdo/configuration/sendusing”)=2
email.Configuration.Fields.Item(“http://schemas.microsoft.com/cdo/configuration/smtpserver”)=”smtp1.techiesweb.com”
email.Configuration.Fields.Item(“http://schemas.microsoft.com/cdo/configuration/smtpserverport”)=25
email.Configuration.Fields.Update
email.Send
End If
set email = Nothing
Copy the VB script in a notepad and save it as TechieswebPM.vbs. Add the process monitoring VB script to Windows schedule task to monitor the required process at a specific internal.
A monitoring script to monitor the monitoring tool
Cheers!!
Melbin Mathew
Melbin Mathew
Latest posts by Melbin Mathew (see all)
- VMware virtual IDE to virtual SCSI hard disk conversion steps – Windows XP - August 6, 2015
- Stop Error “CRITICAL_STRUCTURE_CORRUPTION - August 5, 2015
- Error installing Windows server role and feature required for the Exchange 2010 - December 3, 2013