Prevent duplicates when enrolling, scripted unenroll?

Hello,

Testing Fleet here on our Cloud deployment. I'm building an installer for Elastic Agent that gives us greater control when deploying to endpoints via our management system.

My questions:

  1. Agent allows enrolling more than once, duplicates then show in the list of agents. Any advice on how to prevent this? I was thinking maybe to check the output of elastic-agent status before installing/enrolling, but perhaps there is a better way?

  2. How to unenroll an agent using the agent itself rather than manually in Kibana? This may help with option 1), but would also be useful to build into my uninstaller. The uninstall command for elastic-agent does uninstall everything, but doesn't unenroll the agent from Fleet.

Any help would be appreciated, thanks!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.