Skip to content

Powershell Framework Service Execution Stopped due to ExecutionPolicy on Win10/11 #872

Description

@Wintermute2k6

Problem:

If the icinga-powershell-framework is used on a non server variant of Windows e.g. Windows10/Windows11/Windows11 LTSC.
The Event Viewer / Applications and Services Log will be filled with a Message that the Service is not running or crashed
The additional Debuglog will show Garbage Collector Info.

This comes with the following Output when running Test-IcingaForWindows

Test-IcingaForWindows
[Notice]: Collecting Icinga for Windows environment information
[Passed]: The Icinga Agent service and the Icinga Agent are installed on the system
[Passed]: The Icinga for Windows service is installed on the system
[Failed]: The Icinga for Windows service binary could not be found: ""C:\Program Files\icinga-framework-service\icinga-service.exe\"
Ausnahme beim Aufrufen von "Substring" mit 2 Argument(en):  "Die Länge darf nicht kleiner als 0 (null) sein.
Parametername: length"
In C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:4293 Zeichen:5
+     [string]$ServicePath = $ServiceConfig.ServicePath.SubString(0, $S ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : ArgumentOutOfRangeException
Es ist nicht möglich, eine Methode für einen Ausdruck aufzurufen, der den NULL hat.
In C:\Program Files\WindowsPowerShell\Modules\icinga-powershell-framework\cache\framework_cache.psm1:4295 Zeichen:9
+     if ($ServicePath.Contains('"')) {
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
[Passed]: Your service installation is properly referring to "icinga-powershell-framework.psd1" for module imports.
[Passed]: The Icinga Agent service user "NT Authority\NetworkService" is matching the Icinga for Windows service user "NT Authority\NetworkService"

Actual Behaviour

The icinga-service.exe will be automatically blocked by the ExecutionPolicy which differs in behaviour to the enterprise server versions.

Expected Behaviour

With correct setting of the ExecutionPolicy the icinga-service.exe should start with no restriction.

Workaround.

At this time of writing the actual workaround is to set the ExecutionPolicy manual to the least intrusive state and the wished Scope.

Example:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine

Also Describe here:

https://icinga.com/docs/icinga-for-windows/latest/doc/knowledgebase/IWKB000004/#configure-execution-policies

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions