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 windows service

Votes:

0

Hello,

How can I restart windows service (for example Apache) with PowerShell or batch file remotely?

batch-file powershell restart-service windows-services

Created on Jul 2, 2019 9:08:50 AM



3 Replies

Votes:

1

Hi there,

For this you would need to write a script that performs this action. However you can also use the WMI Service Sensor, which allows you to automatically restart the service:
https://www.paessler.com/manuals/prtg/wmi_service_sensor

Best regards.

Created on Jul 2, 2019 11:19:31 AM by  Dariusz Gorka [Paessler Support]



Votes:

0

Hi Dariusz,

Thanks for the help. Can I use this sensor to react when one URL is not responding? For example, one website gets a timeout after 60 sec, the sensor will restart the service.

Thanks in advance.

Created on Jul 3, 2019 8:14:29 AM



Votes:

1

Hi there,

This is not the intended use case for this sensor. This sensor will constantly monitor if the service is running, if the service is detected as stopped, then PRTG tries to restart the service.

In order to restart services, via triggers, you need to write a custom script (e.g. in PowerShell). This can be added to a notification template under "Setup > Account Settings > Notification Templates > ANY NOTIFICATION > Execute Program".

Best regards.

Created on Jul 3, 2019 2:36:20 PM by  Dariusz Gorka [Paessler Support]




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.