Kaseya Community

Agent Uninstall Script

This question is not answered

We have a former client that claims to have Kaseya agents still installed on some of their workstations, even though they are not checking in to the KSERVER and no longer exist on the KSERVER. They said that the agent appears in their system tray but is greyed out. They are telling us we need to uninstall all the agents, but I am at a loss to determine how to do this. If I had a script that would uninstall, I could have them create a GPO to run the script. That is about the only way I can think of to do this. Does anyone have an uninstall script they could share, or any other suggestions?  Thanks in advance!

Verified Answer
  • I found some information in other forums and was able to build a batch file that accomplishes this task.  Here it is in case anyone else needs it:

    @echo off

    for /f "tokens=3 delims= " %%A in ('sc getkeyname "Kaseya Agent"') do set KGUID=%%A

    for /f "delims=" %%A in ('sc qc %KGUID% ^| find "BINARY_PATH_NAME"') do set KPATH=%%A

    for %%A in (%KPATH%) do set KPATH=%%A

    set KPATH=%KPATH:BINARY_PATH_NAME=%

    set KPATH=%KPATH:: =%

    set KPATH=%KPATH:"=%

    set KPATH=%KPATH:\AgentMon.exe=%

    set KGUID=%KGUID:~2%

    "%KPATH%\KASetup.exe" /r /s /g %KGUID% /l "%TEMP%\kasetup.log"

  • I found some information in the forums and was able to put together a batch file to resolve this.  In case anyone else needs it, here is the batch file:

    @echo off

    for /f "tokens=3 delims= " %%A in ('sc getkeyname "Kaseya Agent"') do set KGUID=%%A

    for /f "delims=" %%A in ('sc qc %KGUID% ^| find "BINARY_PATH_NAME"') do set KPATH=%%A

    for %%A in (%KPATH%) do set KPATH=%%A

    set KPATH=%KPATH:BINARY_PATH_NAME=%

    set KPATH=%KPATH:: =%

    set KPATH=%KPATH:"=%

    set KPATH=%KPATH:\AgentMon.exe=%

    set KGUID=%KGUID:~2%

    "%KPATH%\KASetup.exe" /r /s /g %KGUID% /l "%TEMP%\kasetup.log"

All Replies
  • I found some information in other forums and was able to build a batch file that accomplishes this task.  Here it is in case anyone else needs it:

    @echo off

    for /f "tokens=3 delims= " %%A in ('sc getkeyname "Kaseya Agent"') do set KGUID=%%A

    for /f "delims=" %%A in ('sc qc %KGUID% ^| find "BINARY_PATH_NAME"') do set KPATH=%%A

    for %%A in (%KPATH%) do set KPATH=%%A

    set KPATH=%KPATH:BINARY_PATH_NAME=%

    set KPATH=%KPATH:: =%

    set KPATH=%KPATH:"=%

    set KPATH=%KPATH:\AgentMon.exe=%

    set KGUID=%KGUID:~2%

    "%KPATH%\KASetup.exe" /r /s /g %KGUID% /l "%TEMP%\kasetup.log"

  • I found some information in the forums and was able to put together a batch file to resolve this.  In case anyone else needs it, here is the batch file:

    @echo off

    for /f "tokens=3 delims= " %%A in ('sc getkeyname "Kaseya Agent"') do set KGUID=%%A

    for /f "delims=" %%A in ('sc qc %KGUID% ^| find "BINARY_PATH_NAME"') do set KPATH=%%A

    for %%A in (%KPATH%) do set KPATH=%%A

    set KPATH=%KPATH:BINARY_PATH_NAME=%

    set KPATH=%KPATH:: =%

    set KPATH=%KPATH:"=%

    set KPATH=%KPATH:\AgentMon.exe=%

    set KGUID=%KGUID:~2%

    "%KPATH%\KASetup.exe" /r /s /g %KGUID% /l "%TEMP%\kasetup.log"

  • I was able to put together a batch file based on information I found in the forums.  Here is the batch file if anyone is interested:

    @echo off

    for /f "tokens=3 delims= " %%A in ('sc getkeyname "Kaseya Agent"') do set KGUID=%%A

    for /f "delims=" %%A in ('sc qc %KGUID% ^| find "BINARY_PATH_NAME"') do set KPATH=%%A

    for %%A in (%KPATH%) do set KPATH=%%A

    set KPATH=%KPATH:BINARY_PATH_NAME=%

    set KPATH=%KPATH:: =%

    set KPATH=%KPATH:"=%

    set KPATH=%KPATH:\AgentMon.exe=%

    set KGUID=%KGUID:~2%

    "%KPATH%\KASetup.exe" /r /s /g %KGUID% /l "%TEMP%\kasetup.log"

  • BlueRockTech,

    I tried to add to add  as a friend on the forum. I had a question about this script, do you have time for a chat