How do I restart the Kaseya Agent Service?
Due to constraints, it is not fully possible to successfully restart the Kaseya Agent Service directly using the Agent Procedure commands.
However, using the following steps will allow you to create an Agent Procedure that will successfully restart the Kaseya 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 recommend that you do not run this procedure on more than a few Agents at a time. As this procedure writes files to each endpoint, running on a large number of agents at once could cause a considerable performance impact on your KServer.
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:
Below is a detailed description of what this Agent Procedure does:
- 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, 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.