# How to Uninstall Agent Using Agent Cleanup Tool? When an agent upgrade fails, the existing agent must be completely removed before a fresh installation can succeed. Uninstalling through the Control Panel does not remove all files, folders, and scheduled tasks left by the agent — **AgentCleanupTool** handles the full removal. This article covers cleanup after a failed agent upgrade or when the Central server has been uninstalled; it does not cover Windows Installer package errors encountered during a regular uninstall. ## Prerequisites - For Endpoint Central Cloud, contact support to obtain the AgentCleanupTool along with any one agent registry export. - If the Central server has already been uninstalled and agents still remain on machines, contact support with an agent registry export — the support team will supply the correct cleanup tool. - If you need a cleanup tool that remains valid beyond 48 hours, for example when decommissioning endpoints in bulk or migrating agents from another ManageEngine product, contact support with an agent registry export. To collect agent information, navigate to the appropriate registry path for your Windows architecture. **32-bit Windows** ```text HKEY_LOCAL_MACHINE\SOFTWARE\AdventNet\DesktopCentral\DCAgent ``` **64-bit Windows** ```text HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\AdventNet\DesktopCentral\DCAgent ``` To reach this path, open the Registry Editor by pressing **Windows + R**, typing **regedit**, and pressing **Enter**. Then export the key: 1. Right-click the **DCAgent** key and select **Export**. 2. Set **Save as type** to **Registration Files (*.reg)** and save the file. 3. Compress the **.reg** file into a **.zip** file (not .rar or .7z) and attach it when you contact support. The registry export can be taken from any machine on which the agent is installed and which is managed by the same Endpoint Central server. If the key is not present on the affected machine, export it from another machine. ![How to export registry files for agent cleanup](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/agentcleanup-registryexport.webp) A cleanup tool supplied by Support using an agent registry export is not subject to the 48-hour validity period. It can uninstall any installed version of the agent on computers managed by the server. ## Step 1: Generate Cleanup Files ### Download the AgentCleanupTool ZIP Download [Agent_Cleanup_Tool.zip](https://workdrive.zohoexternal.in/external/6d24bbfa20748b796120764dd8bfc63b1e3c1571bbc87875823b92cae08636db) to the machine where the Central server is installed. **Note:** The ZIP contains all three components required for cleanup across platforms — you no longer need to download the macOS pkg or any other component separately. - **AgentCleanupTool.exe** — main executable; run on the Central server to generate client-side cleanup files. - **UEMS_MacAgent_Cleanup_Tool.pkg** — used for macOS agent cleanup. - **UEMS_LinuxAgent_Cleanup_Tool** — used for Linux agent cleanup. ### Generate Client Cleanup Files 1. Extract the ZIP and open **Command Prompt** as an administrator. ![File Explorer showing AgentCleanupTool.exe in the extracted Agent_Cleanup_Tool folder with the right-click context menu open](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/agentcleanup-toolextract.webp) 2. Navigate to the directory where **AgentCleanupTool.exe** was extracted. 3. Run the tool on the **Central server machine**: ```bat AgentCleanupTool.exe ``` **Warning:** AgentCleanupTool.exe must be run on the machine where the Endpoint Central server is installed. If run on any other machine, an error will appear as shown below. For Endpoint Central Cloud, obtain the tool from support as described in Prerequisites instead of running this step. ![ERROR dialog showing: Please execute the exe in Server installed machine — endpointcentral-agentp14.manageengine.in](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/agentcleanup-windowsagentfailure.webp) When run on the correct Central server machine, a SUCCESS dialog appears confirming that **AgentCleanupToolClient.exe** has been generated. ![SUCCESS dialog showing: AgentCleanupToolClient.exe successfully generated. This tool will be valid for 2 days, applicable only when the uninstallation restriction is enabled — with an OK button](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/agentcleanup-windowssuccess.webp) Click **OK** to proceed — this also triggers the generation of **UEMS_MacAgent_UninstallInfo.plist** for macOS agent cleanup and **UEMS_LinuxAgent_UninstallInfo.json** for Linux agent cleanup in the same directory. **Warning:** - All generated files (**AgentCleanupToolClient.exe**, **UEMS_MacAgent_UninstallInfo.plist**, and **UEMS_LinuxAgent_UninstallInfo.json**) are valid for **48 hours** only. If they expire, re-run **AgentCleanupTool.exe** on the Central server to regenerate them. The validity cannot be checked from the files themselves, so if you are unsure whether they are still valid, regenerate them. - Do not rename any of the generated files. If AgentCleanupToolClient.exe is renamed, the tool stops with the error **Error: Renamed AgentCleanupToolClient**. A numeric suffix such as (1) or (2), which Windows adds when a file with the same name already exists in the folder, also counts as a rename, so confirm that the file is named exactly **AgentCleanupToolClient.exe** before you run it. ## Step 2: Uninstall the Agent Select your platform and follow the steps to remove the agent. ### Windows 1. Copy **AgentCleanupToolClient.exe** to the target Windows machine where the agent needs to be removed. 2. Run **AgentCleanupToolClient.exe** as an administrator. If right-clicking the file and selecting **Run as administrator** does not work, open **Command Prompt** as an administrator and run **AgentCleanupToolClient.exe** from it. 3. The tool runs silently. A Command Prompt window briefly opens and closes, and no confirmation dialog appears. If you run it from Command Prompt, the console shows **Validation Success! Uninstallation of Agent begins**. To confirm that the agent is removed, check that it is no longer listed under **Programs and Features** in the Control Panel. The tool also writes a log file named **AgentUninstallation.log** in the folder it is run from. **Warning:** Do not run AgentCleanupToolClient.exe from the directory where the agent is installed. **Note:** If AgentCleanupToolClient.exe displays **Uninstall Restriction Enabled! Validation failed! Uninstallation of Agent wont occur**, **Security Error: Invalid ServerHashTime** the cleanup tool does not match the computer. This can happen when: - The generated files have expired. - The files were generated by a server other than the one the computer currently reports to, for example after the computer is migrated to Endpoint Central Cloud. - The agent registry key is no longer present on the computer, for example after a partial uninstall. In each case, contact support with a fresh agent registry export to obtain a newly generated AgentCleanupToolClient.exe. If AgentCleanupToolClient.exe cannot be run even with administrator rights, contact support. ### macOS 1. Copy both **UEMS_MacAgent_UninstallInfo.plist** (generated in Step 1) and **UEMS_MacAgent_Cleanup_Tool.pkg** (from the ZIP) to the target Mac machine. Both files must be in the same folder. 2. Double-click **UEMS_MacAgent_Cleanup_Tool.pkg** and complete the prompts as an admin user. ![Extracting the Mac agent cleanup tool package](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/agentcleanup-macagentextract.webp) ![Running the Mac agent cleanup tool](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/agentcleanup-macagentrun.webp) ![Mac agent cleanup tool showing successful removal](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/agentcleanup-macagentsuccess.webp) ![Mac agent cleanup tool confirmation of completion](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/agentcleanup-macagentfailure.webp) ### Linux 1. From the extracted ZIP, locate **UEMS_LinuxAgent_Cleanup_Tool**. 2. Copy both **UEMS_LinuxAgent_UninstallInfo.json** (generated in Step 1) and **UEMS_LinuxAgent_Cleanup_Tool** to the target Linux machine. Both files must be in the same folder. 3. Run the cleanup tool using the following command: ```bash chmod +x UEMS_LinuxAgent_Cleanup_Tool && ./UEMS_LinuxAgent_Cleanup_Tool ``` ![Linux agent cleanup tool showing successful agent removal](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/agentcleanup-linuxsuccess.webp) ![Linux agent cleanup tool showing failed agent removal](https://cdn.manageengine.com/sites/meweb/images/desktop-central/help/device-onboarding/agentcleanup-linuxfailure.webp) ## Remove the Computer from the Server The AgentCleanupTool removes the agent software from the endpoint only. To remove the computer record from the Endpoint Central console, navigate to **Agent → Computers**, select the computers to remove, and choose **Remove Computers**. After you reinstall the agent, if the computer does not appear in the list for approval, check the **Re-Approve** filter under **Computer(s) for Approval**. ## Related Articles - [Endpoint Central On-Premises Agent Installation](https://www.manageengine.com/products/desktop-central/help/device-onboarding/agent-installation-methods.html) - [Endpoint Central Cloud Agent Installation](https://www.manageengine.com/products/desktop-central/help/cloud/device-onboarding/agent-installation-methods.html) - [Uninstall Agent](https://www.manageengine.com/products/desktop-central/agent-uninstallation-methods.html)