simple script for restarting service

Hello

I have one service which is running on server 2016 and this service needs to restart everyday in same excat time. To do this I have create basic ps commands in order to achive mentioned. It is triggered by “task schedule” in Windows. Now problem is with errors which happens when job runs.

this is error msg:

“Task Scheduler did not launch task “\start script” because instance “{23c346c4-3c6c-4fa8-8bde-d242d71dbc05}” of the same task is already running.”

 

PS commands are:

"Stop-Service -Name script-file-service -Force
Start-Service -Name script-file-service "

 

can you please advise how to solve this?

Thank you in advance

ps begginer

:slight_smile: