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

Restart a service not on Core Server network (via Probe)




I've been looking at a guide (https://kb.paessler.com/en/topic/40713-can-i-automatically-restart-a-windows-service-with-prtg) because I'd like to use PRTG to periodically restart a service on a destination server.

I don't want it to restart when the service is down, I just want it to restart at 03:00 each day, for example.

I was doing this with Task Scheduler but there is now a requirement to do this with PRTG so that we get notifications or get an alarm if the service doesn't successfully restart.

This guide above, however, requires the destination server to be resolved by hostname from the Core Server - in my setup, this isn't possible because the Core Server simply connects to a remote probe. The server with the remote probe installed does not have the folders that this guide tell you to put the scripts into (e.g. Notifications\EXE).

Can this be done?

probe prtg remote restart service

Created on Nov 5, 2014 11:28:11 AM

2 Replies



PRTG is not designed for this kind of usage. Sorry. So there is no way to realize this.
Best regards

Created on Nov 14, 2014 2:25:34 PM by  Konstantin Wolff [Paessler Support]



You can use the batch script below as a Custom Sensor with a 30 min sensor interval.

The script needs to be placed in the "Custom Sensors\EXE" folder of your PRTG probe machine.

It will check if the current time is between 03:00 and 03:30 before restarting the service.

You will of cause need to replace the ServerName and ServiceName placeholders with their actual values.

@echo off

For /f "tokens=1-4 delims=/:." %%a in ("%TIME%") do (
    SET HH24=%%a
    SET MI=%%b
    SET SS=%%c
    SET FF=%%d

:Check if hour is 03
IF NOT %HH24% == "03" GOTO ntd

:Check if minute < 30
IF %MI% GTR 10 GOTO ntd

:stop service
SC \\ServerName stop ServiceName > nul
:wait 3 seconds
ping -n 1 -w 3000 > nul
:start service
SC \\ServerName start ServiceName > nul
GOTO restarted

ECHO 0:Nothing to do
GOTO end
ECHO 1:Service has been restarted
GOTO end

Created on Nov 14, 2014 3:05:27 PM

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.