What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general.

Learn more

PRTG Network Monitor

Intuitive to Use. Easy to manage.
More than 500,000 users rely on Paessler PRTG every day. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free Download

Top Tags


View all Tags

Custom WMI sensor/script

Votes:

0

Can someone let me know if it is possible to create a run a vb script to check if a process is running, if the process is not running then restart (stop then start I guess) a Windows service?

My example VB script is here, just wondering if this can be used with a PRTG sensor to automate the recovery:

strComputer = "localhost"

Set wbemServices = GetObject("winmgmts:\\" & strComputer)
Set wbemObjectSet = wbemServices.InstancesOf("Win32_Process")
Set objShell = WScript.CreateObject("WScript.Shell")

for each wbemObject in wbemObjectSet
	If wbemObject.Name = "notepad.exe" then
		wscript.quit
	End If
next

objShell.Run("sc \\" & strComputer & " stop wuauserv && sc \\" & strComputer & " start wuauserv")

Thanks

prtg script wmi

Created on Jun 28, 2013 10:06:57 AM

Last change on Jul 1, 2013 12:23:04 PM by  Torsten Lindner [Paessler Support]



2 Replies

Votes:

0

Hello,

thank you very much for your KB-Post. This should be possible by monitoring the process with a WMI Process Monitor and then using the solution of the following KB-Article to restart the service: Restart a remote service

best regards.

Created on Jul 1, 2013 12:26:26 PM by  Torsten Lindner [Paessler Support]



Votes:

0

Perfect, worked a treat.

Thanks

Created on Jul 2, 2013 7:53:54 AM




Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.