Kaseya Community

How do i successfully restart the Kaseya Service remotely?

This question is answered

I am trying to get the network driver to become enabled and I have found that restarting the Kaseya Service will do that. Rebooting the machine does not allow for the network driver to be installed (even though that's what it says in the documentation). 

My problem is that if I try to restart the service via the restart service option in live connect, it sends the stop command and then can't send the start command because the Kaseya service is in a stopped state.

I have written a VBScript to stop and start the service, but when that script runs via Kaseya, it seems to cause the execution script to run infinitely. I can run the script locally on my machine and it works fine. I assume this is because the kserver kicks off the script and waits for a response from the endpoint and doesn't get a reply stating that it started/ended. 

Is there another option that i can try? 

Verified Answer
  • Here's how I do it - stop and start the service all in one command. I use this trick whenever I want to string commands together as a nearly atomic unit:

    net stop KaseyaService && net start KaseyaService

    RCS-Michael

All Replies
  • Maybe try a batch file with NET STOP and NET START commands and use the Execute Shell Command in the agent procedure to call the batch file?  Might get the the same reuslt as the VB Script file. Not sure.

  • I tend to run it from another machine on the same subnet. The trick is getting the GUID of the agent so you can stop/start it. Here's the script to do the job.

  • lwolf, unfortunately, that has the same result. I appreciate the tip though.

    Greig, I took a look and copied that image so that i can create that script later, but from what i can see, it looks like i would have to manually enter the target machine name. Is that correct? If so i may have to find a different solution because i will have to do this myself to a few hundred machines. Thanks for taking the time to post this solution! :D

    I am going to not mark it as the solution for now...

  • Here's how I do it - stop and start the service all in one command. I use this trick whenever I want to string commands together as a nearly atomic unit:

    net stop KaseyaService && net start KaseyaService

    RCS-Michael

  • Procedure KAgentSVC Remote-Restart(Prompt).zip

    Try this Script.

    Run it against a machine that is in the same network and specify the target machine's IP address or network name in the prompt.

  • Thank you all for your quick responses.

    HardKnoX, that script will definitely be very useful in the future and I have added it to my library. :D

    I found that if I wrote a batch file using RCS-Michael's suggestion it worked out.

    While trying out your guy's methods I also came up with this batch file which seemed to work as well:

    @echo off

    IF EXIST Results.txt GOTO :EndTask

    net stop Kaseya Service > Results.txt

    net start Kaseya Service >> Results.txt

    :EndTask

    Exit

  • @HardKnox: Thanks for your procedure - works like a charm ... it's well done 32 and 64 bit systems ... very much thanks!!

  • The way I have done this in the past is write a batch file with net stop and net start, then used execute file and ensure the K script does not wait for it to complete.