# Error uninstalling the elastic agent

**URL:** <https://discuss.elastic.co/t/error-uninstalling-the-elastic-agent/353142>\
**Category:** Elastic Agent\
**Created:** [February 13, 2024, 9:45am UTC](https://discuss.elastic.co/t/error-uninstalling-the-elastic-agent/353142 "2024-02-13T09:45:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karan37](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karan37/32/131451_2.png) [@Karan37](https://discuss.elastic.co/u/Karan37)\
**Post date:** [February 13, 2024, 9:45am UTC](https://discuss.elastic.co/t/error-uninstalling-the-elastic-agent/353142/1 "2024-02-13T09:45:21Z")

</div>

i am running the uninstall command where the command have to be run but still showing error

```auto
PS C:\Program Files\Elastic\Agent> .\elastic-agent.exe uninstall
Error: can only be uninstalled by executing the installed Elastic Agent at: C:\Program Files\Elastic\Agent\elastic-agent.exe
For help, please see our troubleshooting guide at https://www.elastic.co/guide/en/fleet/8.12/fleet-troubleshooting.html

```

i have also tried the unistall command given on the kibana the command was

```auto
C:\"Program Files"\Elastic\Agent\elastic-agent.exe uninstall --uninstall-token 6a332b605df82adf0f4d1b9b96288902

```

if anyone need additional configuration leave a reply

---

<div class="post-metadata">

**Author:** ![carly.richmond](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/carly.richmond/32/104935_2.png) [@carly.richmond](https://discuss.elastic.co/u/carly.richmond)\
**Post date:** [February 14, 2024, 10:28am UTC](https://discuss.elastic.co/t/error-uninstalling-the-elastic-agent/353142/2 "2024-02-14T10:28:54Z")

</div>

Hi @Karan37,

Are you running the install command as administrator [as per the documentation](https://www.elastic.co/guide/en/fleet/current/uninstall-elastic-agent.html)?

---

<div class="post-metadata">

**Author:** ![Karan37](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/karan37/32/131451_2.png) [@Karan37](https://discuss.elastic.co/u/Karan37)\
**Post date:** [February 14, 2024, 11:14am UTC](https://discuss.elastic.co/t/error-uninstalling-the-elastic-agent/353142/3 "2024-02-14T11:14:57Z")

</div>

thanks for responding @carly.richmond  
yes i was running as administrator only still the same error was showing up so i decided to delete all the files of the elastic agent in the program files but there was this Elastic Agent and fleet server processes that was continously running in the background still after stopping these process would start again within 5 seconds so i have to quickly stop then delete the files i think that kinda worked for me

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 13, 2024, 11:15am UTC](https://discuss.elastic.co/t/error-uninstalling-the-elastic-agent/353142/4 "2024-03-13T11:15:18Z")

</div>

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