When using command "Update-Icinga" to update the Icinga2 Agent, agent config file zones.conf is getting corrupted

During the upgrade process to Icinga2 Agent 2.13.5 using the Icinga PowerShell Framework 1.10.0 the config file “zones.conf” is being emptied (size: 0 kB).
This renders the agent unusable.

Output:

	PS #> Update-Icinga -Name 'agent'
	Do you want to install component "agent" from source "Icinga Local Repo" (C:/temp/icingarepo/repo/agent/Icinga2-v2.13.5-x86_64.msi)? (Y/n): y
	[Notice]: Downloading "agent" from "C:/temp/icingarepo/repo/agent/Icinga2-v2.13.5-x86_64.msi"
	[Notice]: Installing component "agent" with version "2.13.5" into "C:\Program Files\ICINGA2\"
	[Notice]: Stopping service "icinga2"
	[Notice]: Icinga Agent was successfully removed
	[Warning]: Found icinga2.conf backup file created by old PowerShell module. Restoring original configuration
	[Notice]: Successfully backed up Icinga 2 Agent default config
	[Notice]: The Icinga Service User already has permission to run as service
	[Passed]: Directory "C:\ProgramData\icinga2\etc" is accessible and writable by the Icinga Service User "NT Authority\SYSTEM"
	[Passed]: Directory "C:\ProgramData\icinga2\var" is accessible and writable by the Icinga Service User "NT Authority\SYSTEM"
	[Passed]: Directory "C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache" is accessible and writable by the Icinga Service User "NT Authority\SYSTEM"
	[Passed]: Directory "C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\config" is accessible and writable by the Icinga Service User "NT Authority\SYSTEM"
	[Passed]: Directory "C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\certificate" is accessible and writable by the Icinga Service User "NT Authority\SYSTEM"
	[Notice]: Service User ".\LocalSystem" for service "icinga2" successfully updated
	[Notice]: Installation of component "agent" with version "2.13.5" was successful.

I can see that there is a new directory after the upgrade process: C:\ProgramData\icinga2\etc\icinga2\ps_backup
It contains several copied config files including the working “zones.conf”.

I’ve also seen that “Install-IcingaComponent” is calling “Reset-IcingaAgentConfigFile” and “Move-IcingaAgentDefaultConfig” but I have no clue what’s going wrong there.

What can I do to prevent this to happen?

Any advice?

Regards

P.S.: This issue is also documented on Github (Link).

LordHepipud answered the question on GitHub with a recommended approach, see:

“Unfortunately” I do not have any machines left who need an upgrade. So there’s no testing possible from my side, sorry.

As I’ve had several states of config over the years which made it hard to troubleshoot, I decided to copy a set of default config files on each windows host (400+) by a SCCM / MEMCM package.
In config files necessary I’ve replaced a placeholder with the actual host name.

I’ll mark this as resolved.

Regards,
AlexR