Skip to content

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

@dv-27

Description

@dv-27

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions