Icinga / Icinga/icinga-powershell-plugins

Invoke-IcingaCheckScheduledTask works directly but fails via Exit-IcingaExecutePlugin when using -TaskPath array

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

Nobody has claimed this yet.

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

Description

Hi team,

I found a reproducible issue with Invoke-IcingaCheckScheduledTask when called through Exit-IcingaExecutePlugin.

Environment

icinga-powershell-framework: 1.14.2
icinga-powershell-plugins: 1.14.1
Windows Server (PowerShell 5.1)
Icinga 2 command path uses the standard wrapper (PowerShell Base + Exit-IcingaExecutePlugin)
What works (direct invocation)

PS C:\Windows\system32> & 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' -NoProfile -NoLogo -ExecutionPolicy Bypass -Command "Invoke-IcingaCheckScheduledTask -TaskPath @('\Icinga*') -Verbosity 3"

[INFO] Scheduled Tasks (All must be [OK])
_ [INFO] \Icinga\Icinga for Windows\ (All must be [OK])
_ [INFO] Renew Certificate (All must be [OK])
_ [INFO] Last Run Time [2026/04/23 10:26:26]: 1.82h
_ [INFO] Last Task Result: 0
_ [INFO] Missed Runs: 0
_ [INFO] Next Run Time [2026/04/24 01:00:00]: -12.74h
_ [INFO] State: Ready
_ [INFO] Set Process Priority (All must be [OK])
_ [INFO] Last Run Time [2026/04/23 10:27:27]: 1.81h
_ [INFO] Last Task Result: 0
_ [INFO] Missed Runs: 0
_ [INFO] Next Run Time [Never]: Never
_ [INFO] State: Ready
| icinga_icingaforwindows_renewcertificate::ifw_scheduledtask::lastruntime=6565s;;;; icinga_icingaforwindows_renewcertificate::ifw_scheduledtask::lasttaskresult=0;;;; icinga_icingaforwindows_renewcertificate::ifw_scheduledtask::missedruns=0;;;; icinga_icingaforwindows_renewcertificate::ifw_scheduledtask::nextruntime=-45849s;;;; icinga_icingaforwindows_renewcertificate::ifw_scheduledtask::state=3;;;; icinga_icingaforwindows_setprocesspriority::ifw_scheduledtask::lastruntime=6505s;;;; icinga_icingaforwindows_setprocesspriority::ifw_scheduledtask::lasttaskresult=0;;;; icinga_icingaforwindows_setprocesspriority::ifw_scheduledtask::missedruns=0;;;; icinga_icingaforwindows_setprocesspriority::ifw_scheduledtask::nextruntime=0s;;;; icinga_icingaforwindows_setprocesspriority::ifw_scheduledtask::state=3;;;;
0

Expected tasks are returned (e.g. \Icinga\Icinga for Windows...)
Exit code: 0

What fails (wrapper invocation)

PS C:\Windows\system32> & 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'   -NoProfile -NoLogo -ExecutionPolicy Bypass   -Command "try { Use-Icinga -Minimal } catch { Write-Output 'Framework not loaded'; Write-Output $($_.Exception.Message); exit 3 }; Exit-IcingaExecutePlugin -Command 'invoke-icingacheckscheduledtask' -TaskPath @('\Icinga*') -Verbosity 3"

[INFO] Scheduled Tasks: No checks added to this package (All must be [OK])
|

Exit code: 3

Expected behavior
Wrapper invocation via Exit-IcingaExecutePlugin should behave identically to direct invocation and return the same filtered scheduled tasks for -TaskPath @('\Icinga*').

Actual behavior
Only the wrapper path fails (empty package / no checks added), while direct invocation works with the same arguments.

Notes

This is reproducible consistently on the same host/session.
The issue appears specific to the wrapper argument handling path, not the plugin function itself.
Thanks for taking a look.

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 direct Invoke-IcingaCheckScheduledTask command and the Exit-IcingaExecutePlugin wrapper command with the same -TaskPath array. Start by comparing how Exit-IcingaExecutePlugin forwards -TaskPath to Invoke-IcingaCheckScheduledTask. Done means the wrapper returns the filtered \Icinga\ tasks, adds checks to the package, and exits with code 0.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli
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.