Icinga / Icinga/icinga-powershell-framework

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

Open
#872 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PowerShell
Stars
87
Forks
34
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure on Windows 10 or 11 by running Test-IcingaForWindows and checking the Event Viewer output and the additional debug log. Trace how icinga-service.exe is installed and started, using the documented Set-ExecutionPolicy workaround as a comparison. Done means the service starts without manual policy changes and Test-IcingaForWindows no longer reports the missing binary or related errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.