# Failed to remove Icinga Agent: Trying to upgrade or uninstall the agent

**URL:** <https://community.icinga.com/t/failed-to-remove-icinga-agent-trying-to-upgrade-or-uninstall-the-agent/12847>\
**Category:** Icinga 2\
**Tags:** windows-agent\
**Created:** [November 7, 2023, 3:02pm UTC](https://community.icinga.com/t/failed-to-remove-icinga-agent-trying-to-upgrade-or-uninstall-the-agent/12847 "2023-11-07T15:02:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![MartiBarr](https://community.icinga.com/letter_avatar_proxy/v4/letter/m/9f8e36/32.png) [@MartiBarr](https://community.icinga.com/u/MartiBarr)\
**Post date:** [November 7, 2023, 3:02pm UTC](https://community.icinga.com/t/failed-to-remove-icinga-agent-trying-to-upgrade-or-uninstall-the-agent/12847/1 "2023-11-07T15:02:36Z")

</div>

Before you ask a question, you can check [the troubleshooting documentation](https://icinga.com/docs/icinga-2/latest/doc/15-troubleshooting/) first, maybe you can find an answer here.

Please describe your problem as detailed as possible and don’t forget to use a meaningful title There  
We also have a [markdown formatting guide](https://community.icinga.com/t/create-topics-and-master-markdown-formatting/69) to help you make your topics more readable!

Give as much information as you can, e.g.

- Version used (`icinga2 --version`)  
2.13.8 → 2.13.1 down grading to meet requirements of master2 and satellites running.

- Operating System and version  
Windows Server 2019

- Enabled features (`icinga2 feature list`)  
Enabled features: checker notification windowseventlog

- Icinga Web 2 version and modules (System - About)  
Icinga Web 2 Version 2.11.4 running on a seperate server (Oracle Linux)

- Config validation (`icinga2 daemon -C`)  
C:\Program Files (x86)\ICINGA2\sbin\> .\icinga2.exe daemon -C  
[2023-11-07 14:56:32 -0000] information/cli: Icinga application loader (version: v2.13.8)  
[2023-11-07 14:56:32 -0000] information/cli: Loading configuration file(s).  
[2023-11-07 14:56:33 -0000] information/ConfigItem: Committing config item(s).  
[2023-11-07 14:56:33 -0000] information/ConfigItem: Instantiated 244 CheckCommands.  
[2023-11-07 14:56:33 -0000] information/ConfigItem: Instantiated 1 WindowsEventLogLogger.  
[2023-11-07 14:56:33 -0000] information/ConfigItem: Instantiated 1 NotificationComponent.  
[2023-11-07 14:56:33 -0000] information/ConfigItem: Instantiated 1 CheckerComponent.  
[2023-11-07 14:56:33 -0000] information/ConfigItem: Instantiated 1 IcingaApplication.  
[2023-11-07 14:56:33 -0000] information/ScriptGlobal: Dumping variables to file ‘C:\ProgramData\icinga2\var\cache\icinga2/icinga2.vars’  
[2023-11-07 14:56:33 -0000] information/cli: Finished validating the configuration file(s).

- If you run multiple Icinga 2 instances, the `zones.conf` file (or `icinga2 object list --type Endpoint` and `icinga2 object list --type Zone`) from all affected nodes

Zones.conf file is empty on agent server. This maybe due to the removal that I tried.

I have tried to uninstall  
C:\Users\admin-mb\> Uninstall-IcingaAgent -RemoveDataFolder;  
[Notice]: Stopping service “icinga2”  
[Error]: Failed to remove Icinga Agent:  
False  
C:\Users\admin-mb\> Uninstall-IcingaAgent;  
[Notice]: Stopping service “icinga2”  
[Error]: Failed to remove Icinga Agent:  
False  
C:\Users\admin-mb\> Install-IcingaAgent -Version ‘2.14.0’  
[Notice]: Downloading Icinga 2 Agent installer “Icinga2-v2.14.0-x86\_64.msi” into temp directory “C:\Users\admin-mb\AppData\Local\Temp\Icinga2-v2.14.0-x86\_64.msi”  
[Notice]: Installing new Icinga Agent version into "C:\Program Files (x86)\ICINGA2"  
[Notice]: Stopping service “icinga2”  
[Error]: Failed to remove Icinga Agent:  
False

I seem to be stuck in a state where Icinga2 cannot get past the removal of the existing 2.13.8 Icinga2 Agent.

In my configuration of a few Windows Agent i have successfully downgraded them, Only this server has this issue. Is there a lock file that maybe stopping the unistall or update?

---

<div class="post-metadata">

**Author:** ![rivad](https://community.icinga.com/user_avatar/community.icinga.com/rivad/32/5852_2.png) [@rivad](https://community.icinga.com/u/rivad)\
**Post date:** [November 7, 2023, 3:52pm UTC](https://community.icinga.com/t/failed-to-remove-icinga-agent-trying-to-upgrade-or-uninstall-the-agent/12847/2 "2023-11-07T15:52:29Z")

</div>

I had a similar problem and fixed it by moving the icinga folders (install and data) into the trash.  
Afterwards the installation worked.

---

<div class="post-metadata">

**Author:** ![MartiBarr](https://community.icinga.com/letter_avatar_proxy/v4/letter/m/9f8e36/32.png) [@MartiBarr](https://community.icinga.com/u/MartiBarr)\
**Post date:** [November 8, 2023, 7:57am UTC](https://community.icinga.com/t/failed-to-remove-icinga-agent-trying-to-upgrade-or-uninstall-the-agent/12847/3 "2023-11-08T07:57:25Z")

</div>

Hi Dominik, I have tried this and I am still getting the same error.  
I renamed the folder with icinga2 not started.  
I ran  
icinga\> Install-IcingaAgent -Version ‘2.13.1’  
[Notice]: Downloading Icinga 2 Agent installer “Icinga2-v2.13.1-x86\_64.msi” into temp directory “C:\Users\admin-mb\AppData\Local\Temp\Icinga2-v2.13.1-x86\_64.msi”  
[Notice]: Installing new Icinga Agent version into "C:\Program Files (x86)\ICINGA2"  
[Notice]: Stopping service “icinga2”  
[Error]: Failed to remove Icinga Agent:  
False  
I also tried to manually run the install and it also failed.  
I tried 2.14.0 as well and this did not work either.  
icinga\> Install-IcingaAgent -Version ‘2.14.0’  
[Notice]: Downloading Icinga 2 Agent installer “Icinga2-v2.14.0-x86\_64.msi” into temp directory “C:\Users\admin-mb\AppData\Local\Temp\Icinga2-v2.14.0-x86\_64.msi”  
[Notice]: Installing new Icinga Agent version into "C:\Program Files (x86)\ICINGA2"  
[Notice]: Stopping service “icinga2”  
[Error]: Failed to remove Icinga Agent:  
False  
 ![image](https://community.icinga.com/uploads/default/original/2X/1/17f3428a69f9619eb6c3541b08e51321d75efb8d.png)

---

<div class="post-metadata">

**Author:** ![rivad](https://community.icinga.com/user_avatar/community.icinga.com/rivad/32/5852_2.png) [@rivad](https://community.icinga.com/u/rivad)\
**Post date:** [November 8, 2023, 9:00am UTC](https://community.icinga.com/t/failed-to-remove-icinga-agent-trying-to-upgrade-or-uninstall-the-agent/12847/4 "2023-11-08T09:00:58Z")

</div>

Did you also delete / move the `C:\ProgramData\icinga2\` folder?

---

<div class="post-metadata">

**Author:** ![MartiBarr](https://community.icinga.com/letter_avatar_proxy/v4/letter/m/9f8e36/32.png) [@MartiBarr](https://community.icinga.com/u/MartiBarr)\
**Post date:** [November 8, 2023, 9:02am UTC](https://community.icinga.com/t/failed-to-remove-icinga-agent-trying-to-upgrade-or-uninstall-the-agent/12847/5 "2023-11-08T09:02:15Z")

</div>

Yes I moved it to old\_icinga2

---

<div class="post-metadata">

**Author:** ![rivad](https://community.icinga.com/user_avatar/community.icinga.com/rivad/32/5852_2.png) [@rivad](https://community.icinga.com/u/rivad)\
**Post date:** [November 8, 2023, 9:05am UTC](https://community.icinga.com/t/failed-to-remove-icinga-agent-trying-to-upgrade-or-uninstall-the-agent/12847/6 "2023-11-08T09:05:51Z")

</div>

I guess, now a msi guru is needed as I’m no Windows expert.  
Removing the folders and the keys in the registry should allow a new installation I guess.  
I wouldn’t mess with the registry without a backup / snapshot of the machine.

---

<div class="post-metadata">

**Author:** ![MartiBarr](https://community.icinga.com/letter_avatar_proxy/v4/letter/m/9f8e36/32.png) [@MartiBarr](https://community.icinga.com/u/MartiBarr)\
**Post date:** [November 8, 2023, 9:07am UTC](https://community.icinga.com/t/failed-to-remove-icinga-agent-trying-to-upgrade-or-uninstall-the-agent/12847/7 "2023-11-08T09:07:19Z")

</div>

We have snapshots of this machine. Are there any MSI guru’s on here?
