Restart Agent Service via Agent Procedure


Due to agent procedure constraints, it is not possible to successfully restart the Kaseya Agent service on an endpoint



The following agent procedure will successfully restart an agent service on the endpoint.


1) Step 1 - Identify the name of the Kaseya Agent Service you want to restart:



2) Step 2 - Download and modify the attached RestartAgent.bat and confirm the file has the appropriate Agent Service name:



3) Step 3 - Upload the RestartAgent.bat to the kserver shared file directory:





4) Step 4 - Upload the attached Procedure Folder Restart Agent Service.xml by navigating to Agent Procedures>Manage Procedures>Schedule/Create and selecting the directory in which you would like to upload these procedures. Once selected, click on the Import Folder/Procedure Button and upload the xml:



5) Step 5 - Confirm the procedures uploaded successfully and both procedures are present:



6) Step 6 - Select the 0 - Run This procedure and select the agent(s) you wish to run this procedure on:



Note: We highly suggest against running this on more than a few agents at a time as the procedure writes files to endpoints and that could cause a large performance impact on your server.


After roughly 2 minutes, your agent should stop and start, you can confirm this by checking the agent logs located in Agent>Machine Status>Agent Logs:



A detailed description of what this procedure does is as follows:

  • A .bat file that stops and starts the agent service is written to the agent temp directory.
  • A command is sent to add a schedule to the Windows Task Scheduler with an arbitrary future date (01/01/2099)
  • A command is set to immediately execute the task.
  • The command executes in roughly 2 minutes.
  • The second procedure is scheduled to, after 3 minutes, to delete the task from the scheduler and the .bat script from the temp directory.

Please note, if the agent is experiencing any external issue that causes the starting or stopping process to fail or take too long, you may lose connectivity to the agent, please run this procedure understanding that risk. In these cases, it will be necessary to manually start the service.




Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request


Article is closed for comments.