In some cases it might happen that the icinga2 or other services are still accessed by our current PowerShell instance and blocking the removal for example.
In case this happens, installations and uninstallations will fail as long as the PowerShell instance blocking the service is closed. This issue might also happen when the service is being opened inside the service manager.
To resolve this issue, we should separate the installation/uninstallation and service handling Cmdlets to use an own PowerShell instance which is closed afterwards, freeing the access to certain objects.