KACE: Silent removal of unresponsive Kace agents

When Kace agents become unresponsive, due to eg hibernation of the laptop are broken configuration it needs to be uninstalled.


Here is a tool to silently uninstall agents from multiple computers at once over the network with no user notifications or user interaction.
The computers need to be connected to the network.


The script uses the PSexec util found on https://technet.microsoft.com/en-us/sysinternals/bb897553.aspx

PsExec is a light-weight telnet-replacement that lets you execute processes on other systems, complete with full interactivity for console applications, without having to manually install client software. PsExec's most powerful uses include launching interactive command-prompts on remote systems and remote-enabling tools like IpConfig that otherwise do not have the ability to show information about remote systems.

Note: some anti-virus scanners report that one or more of the tools are infected with a "remote admin" virus. None of the PsTools contain viruses, but they have been used by viruses, which is why they trigger virus notifications.

Installation: Save PsExec to a folder of your choice.  For me it's c:\temp Just be sure to adjust the command accordingly if you place PSexec somewhere else.
note: Typing "psexec" displays its usage syntax.


Script requisites

1. Computer list
create a text file called computerlist.txt, and type all computer names needing the Kace agent removal in there.  Should you want to use IP addresses instead of machine names, that is no problem  

save this file in the same location as your PSexec.exe file

2. Removal script
create a bat file called ampuninstall.bat and add the following 2 lines      

cd C:\Program Files\dell\kace
AMPTools uninstall all

save this batch file in the same location as your PSexec.exe file and the computerlist.txt

IMPORTANT - this is for x86 computers
in case of x64 computers be sure to change the program files folder location

cd C:\Program Files (x86)\dell\kace
AMPTools uninstall all

save this batch file in the same location as your PSexec.exe file and the computerlist.txt


note: see https://support.software.dell.com/k1000-systems-management-appliance/kb/146458 for more AMPTools command switches

3. Script

for /f %G in ('type "c:\temp\computerlist.txt"') do psexec \\%G -s -c -accepteula ampuninstall.bat


run the script by opening a command prompt and browse to your folder where PSexec is placed into - for me it's c:\temp.
should you use a different location, be sure to to adjust the command accordingly. 

explanation of the script

-s = run as local system
-c = copy file (ampuninstall.bat) over to client and then execute
-accepteula = not to show the popup to accept the use of PSexec

Essentially what this command does is sets a variable for the machine name, and for every line in the computerlist.txt file, replaces that variable (%G) with the target IP or hostname you want to connect to.
Whenever the script can't connect to a computer it will skip and move on to the next one in the list


Sources - combination of these 2 Kace KB's and a lot of sweat and testing


Agent reinstallation

Once successfully removed, the Kace agent will reinstall itself from GPO.


  • Hi bvangeel,

    This was a life saver, thanks!

    Just wanted to note the tweaks I made,

    The batch script I used was
    CD C:\PSTools
    FOR /F "tokens=1,2* delims=," %%G IN (C:\PSTools\1.txt) do psexec \\%%G -s -c -accepteula ampuninstall.bat

    1.txt contains a line delimited list exported from KACE (to csv then copied the column to notepad)

    Also had to run the script as admin (otherwise 'CD' would not take effect??) - aarmington 5 years ago
  • I followed the steps above and adjusted this a little to run the retrust command and it worked great. This saved me a tone of time.

    The batch was:
    cd C:\Program Files (x86)\dell\kace
    amptools.exe retrust - cyborgpoet 3 years ago
This post is locked

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ