Hey Ninjas, 

A helpful batch file I "rebuilt" / added lines too.

KACE batch can be found in the K1000 share (next to the agent .MSI) named agent_msi_remove.bat

I added the Reg deletes needed to remove the registery keys to completely clean the system. (highlighted in Orange)

Example: If you are imaging a machine and forget to uninstall the KACE agent this is very useful because it will pick up the last machine imaged as the machineID of the originally imaged machine. the fix is the run this batch and then install KACE agent again.

RENAMED: agent_msi_remove_regdelete.bat

(New code is in Orange)

Hope this is useful for someone. Enjoy!

This or the Default KACE script = Reset KUID  (which I didn't know about tell after I rebuilt this batch  :) )
______________________________________________________

@echo off

REM    Copyright 2012 Dell Inc.
REM    All rights reserved.
REM
REM    File: agent_msi_remove.bat
REM
REM    This bat controls K1000 Agent auto-removal
REM    This file should be located in the K1000
REM    client\agent_provisioning\window_platform
REM    shared directory.
REM
REM    Params:
REM      %1 - optional, if present and "1", then also removes all left-over config files
REM

echo

Reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Dell /va /f
Reg delete HKEY_LOCAL_MACHINE\SOFTWARE\KACE /va /f
Reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Dell /va /f
Reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\KACE /va /f

echo [MSGCODE: 000] Begin agent_msi_remove.bat processing.

:: Set KProgramFiles to 32-bit dir on x64
SET KProgramFiles=%ProgramFiles(x86)%
IF NOT EXIST "%KProgramFiles%" SET KProgramFiles=%ProgramFiles%

IF EXIST "%KProgramFiles%\Dell\KACE\AMPTools.exe" goto detected
IF EXIST "%KProgramFiles%\kace\kbox\kinstaller.exe" goto detected
REM *** This line should never be reached, but I'm editing it and leaving it here for posterity's sake
IF EXIST "%ProgramFiles%\kace\kbox\kinstaller.exe" goto detected

echo [MSGCODE: 002] K1000 Agent is not installed.
goto end


:detected

REM *** K1000 AGENT REMOVAL (5.2 or later) ***
REM  Launch AMPTools.exe in uninstall mode 
REM 

IF NOT EXIST "%KProgramFiles%\Dell\KACE" goto 51agent
IF NOT EXIST "%KProgramFiles%\Dell\KACE\AMPTools.exe" goto 51agent


echo [MSGCODE: 005] K1000 Agent is detected.
echo [MSGCODE: 006] Removing K1000 Agent.
cd /D "%KProgramFiles%\dell\kace"
REM Change the dir since AMPTools can't remove current dir
cd ..
start /wait kace\AMPTools.exe -uninstall

REM We need to wait 15 seconds for msiexec to complete agent uninstall
ping 127.0.0.1 -n 15 -w 1000 > nul

REM *** ADDITIONAL CLEANUP ACTIONS ***
REM  Remove any unused or unwanted files here
REM  Example: Remove any residual 5.2+ agent files
REM  rmdir /S /Q "%KProgramFiles%\Dell\KACE"
if "%1" == "1" echo [MSGCODE: 010] Removing all agent files.
if "%1" == "1" rmdir /S /Q "%KProgramFiles%\Dell\KACE"

REM Report if the agent is installed, so the K1000 provisioning system 
REM can record success or failure.
REM The server will be looking for this string, so don't change it, 
REM without changing it as well.
if exist "%KProgramFiles%\Dell\KACE\AMPTools.exe" echo [MSGCODE: 003] Uninstall failed: K1000 Agent NOT removed.
if not exist "%KProgramFiles%\Dell\KACE\AMPTools.exe" echo [MSGCODE: 004] K1000 Agent successfully uninstalled.


:51agent

REM *** K1000 AGENT REMOVAL (5.1 or earlier) ***
REM  Launch kinstaller.exe in UNINSTALL mode 
REM  This uninstall call uses the existing 
REM  kinstaller.exe in the K1000 program files 
REM  directory to do all the work of 
REM  uninstalling the K1000 agent
REM 

IF NOT EXIST "%KProgramFiles%\kace\kbox" goto oldagent
IF NOT EXIST "%KProgramFiles%\kace\kbox\kinstaller.exe" goto oldagent
goto endExistsCheck

REM To remove any old agent installed at hard coded location  ...
:oldagent
IF NOT EXIST "%ProgramFiles%\kace\kbox" goto end
IF NOT EXIST "%ProgramFiles%\kace\kbox\kinstaller.exe" goto end
set KProgramFiles=%ProgramFiles%

:endExistsCheck
cd /D "%KProgramFiles%\kace\kbox"
start /wait kinstaller.exe -display_mode=silent -uninstall


REM *** ADDITIONAL CLEANUP ACTIONS ***
REM  Remove any unused or unwanted files here
REM  Example: Remove any residual 1.x agent files
REM  rmdir /S /Q "%KProgramFiles%\KACE\KBOX-DM"
if "%1" == "1" echo [MSGCODE: 010] Removing all agent files
REM Change the dir since rmdir can't remove current dir
cd ..
if "%1" == "1" rmdir /S /Q "%KProgramFiles%\KACE\KBOX"

REM Report if the agent is installed, so the K1000 provisioning system 
REM can record success or failure.
REM The server will be looking for this string, so don't change it, 
REM without changing it as well.
if exist "%KProgramFiles%\kace\kbox\kboxclient.exe" echo [MSGCODE: 003] Uninstall failed: K1000 Agent NOT removed.
if not exist "%KProgramFiles%\kace\kbox\kboxclient.exe" echo [MSGCODE: 004] K1000 Agent successfully uninstalled.


:end
echo [MSGCODE: 100] End agent_msi_remove.bat processing.