Hello,
How can I restart windows service (for example Apache) with PowerShell or batch file remotely?
Article Comments
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.
Jul, 2019 - Permalink
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.
Jul, 2019 - Permalink
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.
Jul, 2019 - Permalink