Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 30534

Re: restart kaseya agent

$
0
0

Here's a batch file i'm working on that will schedule the agent to restart after 5 minutes using the windows scheduler. It has some limitations, like if if the minutes are between 55 - 59 or 0 - 4 it will break the logic in the math, but it's effective the other 50 minute window.... well, as long as it isn't turning to midnight too... either way. it could be handy.

restartkaseyagent.bat

---------------------

set h=%TIME:~0,2%

set m=%TIME:~3,2%

set/a m2="m+5"

set t2=%h%:%m2%

set t2

set d2=%DATE:~4,10%

set d2

echo net stop KAgentServiceID >C:\ktemp\restartagent2.bat

echo net start KAgentServiceID >>c:\ktemp\restartagent2.bat

schtasks /create /tn "Kaseya Agent Restart" /tr c:\ktemp\restartagent2.bat /sc once /st %t2% /sd %d2% /ru SYSTEM /F

---------------------

When it adds 5 minutes to 55+  it turns the minutes to 60-65, which breaks the %t2% variable. When it is less than 4 and adds 5, the result isn't in double digits, which has the same effect of breaking the script. I would assume that  going from 23 hours to 24 hours would also be a bad time to run it.


Viewing all articles
Browse latest Browse all 30534

Trending Articles