Ask the Community
Groups
Restarting the Kaseya Agent Service via Agent Procedure - Connect IT Community | Kaseya
<main> <article class="userContent"> <p><strong><u>QUESTION</u></strong></p> <p>How do I restart the Kaseya Agent Service?</p> <p><strong>ANSWER</strong></p> <p>Due to constraints, it is not fully possible to successfully restart the Kaseya Agent Service directly using the Agent Procedure commands. </p> <p>However, using the following steps will allow you to create an Agent Procedure which will successfully restart the Kaseya Agent Service on the endpoint.</p> <p>1) Step 1 - Identify the name of the <strong>Kaseya Agent Service</strong> you want to restart:</p> <p><img src="/attachments/token/d84MHuX4J302Thvxsi5TTJ6Lp/?name=12-18-2015+12-47-44+PM.png" alt="12-18-2015_12-47-44_PM.png" class="embedImage-img importedEmbed-img"></img></p> <p> </p> <p>2) Step 2 - Download and modify the attached <strong>RestartAgent.bat</strong> and confirm the file has the appropriate Agent Service name:</p> <p><img src="/attachments/token/3FtuzCXCqtZ46aiThlVggAvW7/?name=12-18-2015+1-42-12+PM.png" alt="12-18-2015_1-42-12_PM.png" class="embedImage-img importedEmbed-img"></img></p> <p> </p> <p>3) Step 3 - Upload the <strong>RestartAgent.bat</strong> to the kserver shared file directory:</p> <p><img src="/attachments/token/MbPu9gAuiz8f3wTrNMmZrU1Zo/?name=12-18-2015+12-51-46+PM.png" alt="12-18-2015_12-51-46_PM.png" class="embedImage-img importedEmbed-img"></img></p> <p><img src="/attachments/token/jK3Xs1SsZ3q7R0XBoyOvjt4B5/?name=12-18-2015+12-52-14+PM.png" alt="12-18-2015_12-52-14_PM.png" class="embedImage-img importedEmbed-img"></img></p> <p><img src="/attachments/token/rVWM1rBZcilgYWP3SQUXduTnH/?name=12-18-2015+12-52-40+PM.png" alt="12-18-2015_12-52-40_PM.png" class="embedImage-img importedEmbed-img"></img></p> <p> </p> <p>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 <strong>Import Folder/Procedure</strong> Button and upload the xml:</p> <p><img src="/attachments/token/GbhxS95hR9eXTY7b3nMeQJa9k/?name=12-18-2015+12-58-41+PM.png" alt="12-18-2015_12-58-41_PM.png" width="836" height="283" class="embedImage-img importedEmbed-img"></img></p> <p> </p> <p>5) Step 5 - Confirm the procedures uploaded successfully and both procedures are present:</p> <p><img src="/attachments/token/QCwJiiX2chrM69uGGgvmsxHY5/?name=12-18-2015+1-00-20+PM.png" alt="12-18-2015_1-00-20_PM.png" class="embedImage-img importedEmbed-img"></img></p> <p> </p> <p>6) Step 6 - Select the 0 - Run This procedure and select the agent(s) you wish to run this procedure on:</p> <p><img src="/attachments/token/IOE1om3idxkNWsAxQsqBRLjNR/?name=12-18-2015+1-01-15+PM.png" alt="12-18-2015_1-01-15_PM.png" class="embedImage-img importedEmbed-img"></img></p> <p> </p> <p><em><strong>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. </strong></em></p> <p>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:</p> <p><img src="/attachments/token/LSRBveGMO1ZGyRQtt3kG9shW3/?name=12-18-2015+1-03-19+PM.png" alt="12-18-2015_1-03-19_PM.png" width="804" height="161" class="embedImage-img importedEmbed-img"></img></p> <p> </p> <p>Below is a detailed description of what this Agent Procedure does:</p> <ul><li>A .bat file that stops and starts the agent service is written to the agent temp directory.</li> <li>A command is sent to add a schedule to the Windows Task Scheduler with an arbitrary future date (01/01/2099)</li> <li>A command is set to immediately execute the task.</li> <li>The command executes in roughly 2 minutes.</li> <li>The second procedure is scheduled to, after 3 minutes, to delete the task from the scheduler and the .bat script from the temp directory.</li> </ul><p><em><strong>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.</strong></em></p> <p><strong>APPLIES TO</strong></p> <p>All Versions</p> </article> </main>