Kaseya Community

Enabling RC is disabled by user

This question is answered

So it was discovered that during the set up for some agents that "Disable Remote Control" was still allowed. The problem is a couple of the users, one in particular who I need to interact with "quietly", have disabled remote control so now we're unable to retrieve files.

Is there any way with 9.2+ to enable remote control without informing the user to do so?

Verified Answer
  • Hi timkude

    In this case You can running procedure to enabling remote control with batch file (.bat)

    i used this script:

    @ECHO off

    net stop KAASNFR930191239871018( your Kaseya agent service name )

    reg add  HKEY_LOCAL_MACHINE\SOFTWARE\Kaseya\Agent\ASNFR930191239871018 /V EnableRemoteControl /t REG_DWORD /d 1 /f

    net start KAASNFR930191239871018(Kaseya agent service name)

    ECHO on

    Cheers_

    Karisma

All Replies
  • Hi timkude

    In this case You can running procedure to enabling remote control with batch file (.bat)

    i used this script:

    @ECHO off

    net stop KAASNFR930191239871018( your Kaseya agent service name )

    reg add  HKEY_LOCAL_MACHINE\SOFTWARE\Kaseya\Agent\ASNFR930191239871018 /V EnableRemoteControl /t REG_DWORD /d 1 /f

    net start KAASNFR930191239871018(Kaseya agent service name)

    ECHO on

    Cheers_

    Karisma

  • Karisma,

    In testing this suggestion, I'm having sporadic success with the service actually stopping and starting. Is there a way to guarantee that the service stops?

  • I use:

    taskkill /IM AgentMon.exe /F

    Nate

  • Ah, okay. I'll try that and see if that's what is holding up the service. Thanks!

  • So after some testing I figured out what I had to do:

    Since all our machines are running Win7 Pro x64, I had to update the registry key under HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Kaseya\Agent\. After doing that it reflects correctly when a change is made.

    Thanks!

  • Could you tell me how you run these .bat scripts on agents?

    I am new to scripting and only experienced a little with SQL and XML scripts so far.

    In case you run this in combination with a XML script, could you share this script with me?

  • Pattie

    Could you tell me how you run these .bat scripts on agents?

    I am new to scripting and only experienced a little with SQL and XML scripts so far.

    In case you run this in combination with a XML script, could you share this script with me?

    Creating procedures to run batch files is super easy and a good way to learn how to use Kaseya procedures.

    1) Upload your finished batch file.  To do this go to Agent Procedures -> Manage Procedures -> Schedule / Create -> Manage Files.

    2) Once the batch file is uploaded, create a new procedure.  You'll need 2 lines to make it work.  Line 1: writeFile.  Browse to your batch file and select it, then decide where you want to save it on the endpoint machine.  The managed temp directory is great for this.

    3) Line 2: executeFile.  Use the path you just saved the batch file to on the endpoint machine.

    4) [optional] use deleteFile to remove the batch file once you're done.

    Here's an example of a procedure that runs a batch file called sample.bat:

    <?xml version="1.0" encoding="UTF-8"?>

    -<ScriptExport xmlns="www.kaseya.com/.../Scripting" xmlns:xsd="www.w3.org/.../XMLSchema" xmlns:xsi="www.w3.org/.../XMLSchema-instance">

    -<Procedure treeFullPath="Examples" folderId="98138232322211677723822112" id="267438593" treePres="3" name="Run A Sample Batch File">

    -<Body description="">

    -<Statement name="WriteFile" osType="Windows" continueOnFail="false">

    <Parameter name="Path" value="c:\temp\kaseya\sample.bat" xsi:type="StringParameter"/>

    <Parameter name="ManagedFile" value="sample.bat" xsi:type="StringParameter"/>

    <Parameter name="DeleteAfter" value="False" xsi:type="BooleanParameter"/>

    </Statement>

    -<Statement name="ExecuteFile" osType="Windows" continueOnFail="false">

    <Parameter name="Path" value="c:\temp\kaseya\sample.bat" xsi:type="StringParameter"/>

    <Parameter name="Arguments" value="/s" xsi:type="StringParameter"/>

    <Parameter name="ExecuteAccount" value="System" xsi:type="EnumParameter"/>

    <Parameter name="WaitComplete" value="True" xsi:type="BooleanParameter"/>

    </Statement>

    -<Statement name="DeleteFile" osType="Windows" continueOnFail="false">

    <Parameter name="Path" value="c:\temp\kaseya\sample.bat" xsi:type="StringParameter"/>

    </Statement>

    </Body>

    </Procedure>

    </ScriptExport>

  • Awesome, thanks for such a detailed explanation mcconnell!

  • All - Here is my batch script that I use writeFile and executeShellCommand to copy and run on non-compliant machines.

    @ECHO off

    net stop "Kaseya Agent"
    taskkill /IM AgentMon.exe /F
    set keypath32=empty
    set keypath64=empty

    REM 32Bit OS
    for /f "tokens=6 delims=\" %%i in ('reg query HKLM\SOFTWARE\Kaseya\Agent\ /k /f *') do set keypath32=%%i
    IF "%keypath32%"=="empty" (
    REM DO NOTHING
    ) ELSE (
    CALL :32bit
    )


    REM 64Bit OS
    for /f "tokens=6 delims=\" %%i in ('reg query HKLM\SOFTWARE\Wow6432Node\Kaseya\Agent\ /k /f *') do set keypath64=%%i
    IF "%keypath64%"=="empty" (
    REM DO NOTHING
    ) ELSE (
    CALL :64bit
    )

    :32bit
    reg add HKEY_LOCAL_MACHINE\SOFTWARE\Kaseya\Agent\%keypath32% /V EnableRemoteControl /t REG_DWORD /d 1 /f
    CALL :restart

    :64bit
    reg add HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Kaseya\Agent\%keypath64% /V EnableRemoteControl /t REG_DWORD /d 1 /f
    CALL :restart

    :restart
    net start "Kaseya Agent"
    EXIT

    NOTES

    • We have a mildly mixed environment so I check for the 32-bit key, if not found it continues to the 64-bit key, then moved to the appropriate sub function depending on which was found.
    • The for loops allows me to eliminate the need for editing the batch script special for each machine and I can instead simply kick off the procedure against a machine.
    • Even though I have only seen the service stop once successfully, I still try to stop the service before simply killing off AgentMon.exe