Error installing Icinga Agent


I would like to install the Icinga2 PowerShell module as I have done on many servers.
But there are 2-3 that are extremely resistant.

This is a Windows 2016 Server Datacenter.
I use the following script to install the agent:

[Net.ServicePointManager]::SecurityProtocol = 'tls12, tls11';
$ProgressPreference                         = 'SilentlyContinue';
[string]$ScriptFile                         = 'C:\Users\Public\IcingaForWindows.ps1';

Invoke-WebRequest `
    -UseBasicParsing `
    -Uri '' `
    -OutFile $ScriptFile;

& $ScriptFile `
    -ModuleDirectory 'C:\Program Files\WindowsPowerShell\Modules\' `

Remove-Item C:\Users\Public\IcingaForWindows.ps1

Start-IcingaAgentInstallWizard `
    -DirectorUrl            'http://IP/icingaweb2/director/' `
    -SelfServiceAPIKey      'Key' `
    -UseDirectorSelfService 1 `
    -OverrideDirectorVars   0 `
    -Reconfigure `

I get the following error there:

Start-IcingaAgentInstallWizard `
    -DirectorUrl            'http://IP/icingaweb2/director/' `
    -SelfServiceAPIKey      'Key' `
    -UseDirectorSelfService 1 `
    -OverrideDirectorVars   0 `
    -Reconfigure `

[Notice]: PowerShell Execution-Policies are configured to run Scripts and/or Modules.
[Notice]: Icinga PowerShell Framework is already installed. Using Framework functions for kickstarter.
[Notice]: Loading Icinga PowerShell Framework.
[Notice]: Using hostname "Servername" for the Icinga Agent configuration
Is your public Icinga 2 CA (ca.crt) available on a local, network or web share? (Y/n): n
[Notice]: The wizard is complete. These are the configured settings:
-UseDirectorSelfService 1
-DirectorUrl 'http://IP/icingaweb2/director/'
-SelfServiceAPIKey 'Key'
-OverrideDirectorVars 0
-AcceptConnections 1
-CAFile ''
-EmptyCA 1
-InstallFrameworkPlugins 0
-InstallFrameworkService 0

Start-IcingaAgentInstallWizard -UseDirectorSelfService 1 -DirectorUrl 'http://IP/icingaweb2/director/' -SelfServiceAPIKey 'Key' -OverrideDirectorVars 0 -AcceptConnections 1 -CAFile '' -E
mptyCA 1 -InstallFrameworkPlugins 0 -InstallFrameworkService 0 -RunInstaller
[Notice]: Found installed .NET Framework version 4.6.01586
[Notice]: Downloading Icinga 2 Agent installer "Icinga2-v2.13.3-x86_64.msi" into temp directory "C:\Users\SERVER~1\AppData\Local\Temp\Icinga2-v2.13.3-x86_64.msi"
[Notice]: Installing new Icinga Agent version into "C:\Program Files\ICINGA2"
[Error]: Failed to install Icinga 2 Agent: 
[Notice]: A backup of your default configuration is not required. A backup was already made
It is not possible to call a method for an expression that has the NULL.
In C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:7051 Zeichen:9
+     if ($ConfigContent.Contains('//const NodeName = "localhost"')) {
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
[Notice]: Your hostname was successfully changed to "Servername"
[Warning]: No path specified for Framework service. Service will not be installed
[Notice]: Background daemon Cmdlet "Start-IcingaServiceCheckDaemon" has been configured
The Icinga Agent seems not to be installed
In C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:4517 Zeichen:9
+         throw 'The Icinga Agent seems not to be installed';
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (The Icinga be installed:String) [], RuntimeException
    + FullyQualifiedErrorId : The Icinga Agent seems not to be installed

Does anyone maybe have an idea what I can do to fix the error?

Thanks in advance