2025-01-23
Endpoint Central offers a feature called Agent Protection Settings that, when enabled, prevents end-users from uninstalling the agent without first providing a Time-based One-Time Password (TOTP) issued by the Endpoint Central administrator. So, what if there is a problem with the TOTP generation? None, you can still uninstall the agent following these steps:
Edit a copy of the uninstaller script
/usr/local/manageengine/uems_agent/RemoveUEMSAgent.sh
.
Comment out the following line.
$agent_install_directory/bin/dcregister -u $1 $2 || script_exit $?
Run the modified script as root.
That deletes almost all of the relevant files, what only remains are the services.
Delete the mentioned services.
sudo rm -f /etc/systemd/system/dcservice.service
sudo rm -f /etc/init.d/dcservice
That’s all! You can now register a new UEMSAgent.
If you register the new UEMSAgent and later find that the uninstaller script fails, simply repeat the steps mentioned in this section, and the problem will be resolved for future uninstallations.