Restarting the Kaseya Agent Service via Agent Procedure

Question

How do I restart the Kaseya Agent Service?

Answer

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:

12-18-2015_12-47-44_PM.png

 

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

12-18-2015_1-42-12_PM.png

 

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

12-18-2015_12-51-46_PM.png

12-18-2015_12-52-14_PM.png

12-18-2015_12-52-40_PM.png

 

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:

12-18-2015_12-58-41_PM.png

 

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

12-18-2015_1-00-20_PM.png

 

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

12-18-2015_1-01-15_PM.png

 

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:

12-18-2015_1-03-19_PM.png

 

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.

APPLIES TO

All Versions

Attachments

Have more questions?

Contact us

Was this article helpful?
2 out of 2 found this helpful

Provide feedback for the Documentation team!

Browse this section