# How do you uninstall an Elastic Agent?

**URL:** <https://discuss.elastic.co/t/how-do-you-uninstall-an-elastic-agent/334711>\
**Category:** Elastic Agent\
**Created:** [May 30, 2023, 6:14pm UTC](https://discuss.elastic.co/t/how-do-you-uninstall-an-elastic-agent/334711 "2023-05-30T18:14:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![learningelastic](https://avatars.discourse-cdn.com/v4/letter/l/958977/32.png) [@learningelastic](https://discuss.elastic.co/u/learningelastic)\
**Post date:** [May 30, 2023, 6:14pm UTC](https://discuss.elastic.co/t/how-do-you-uninstall-an-elastic-agent/334711/1 "2023-05-30T18:14:57Z")

</div>

My computer crashed while I was installing an elastic agent. So I rebooted and tried again, but the `elastic-agent.exe install ...etc...` gave an error say it is unabel to, and that i need to uninstall it first. So then I ran this command:

```auto
PS C:\Program Files\Elastic\Agent> .\elastic-agent.exe uninstall
Elastic Agent will be uninstalled from your system at C:\Program Files\Elastic\Agent. Do you want to continue? [Y/n]:Y

```

I've waited several hours and there's no response from the command. I rebooted my computer and tried the uninstall command again . Again it just stays stuck on that screen. I waited a few more hours but still no response.

How do I uninstall an Elastic Agent?

---

<div class="post-metadata">

**Author:** ![Priscilla\_Parodi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/priscilla_parodi/32/43047_2.png) [@Priscilla\_Parodi](https://discuss.elastic.co/u/Priscilla_Parodi)\
**Post date:** [May 30, 2023, 7:24pm UTC](https://discuss.elastic.co/t/how-do-you-uninstall-an-elastic-agent/334711/2 "2023-05-30T19:24:47Z")

</div>

Hello @learningelastic,

Because Elastic Agent is installed as an auto-starting service, it will restart automatically if the system is rebooted. So, what is the status of your agent? `elastic-agent status` logs: `C:\Program Files\Elastic\Agent\data\elastic-agent-*\logs\`

If any Elastic Agent-related processes are still running, [stop them](https://www.elastic.co/guide/en/fleet/current/start-stop-elastic-agent.html#stop-elastic-agent-service) and then try running the following commands:

```auto
cd %TEMP%
copy "c:\Program Files\Elastic\Endpoint\elastic-endpoint.exe" elastic-endpoint.exe
.\elastic-endpoint.exe uninstall
del .\elastic-endpoint.exe

```

Hope this helps but I would also check this link: [troubleshoot common problems.](https://www.elastic.co/guide/en/fleet/current/fleet-troubleshooting.html)

---

<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:** [June 27, 2023, 7:25pm UTC](https://discuss.elastic.co/t/how-do-you-uninstall-an-elastic-agent/334711/3 "2023-06-27T19:25:37Z")

</div>

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