From 73dd3648d3b1b6f58639b6dcda3a8573de63af5e Mon Sep 17 00:00:00 2001 From: Lord Hepipud Date: Sun, 28 Aug 2022 11:29:59 +0200 Subject: [PATCH] Fixes stacktrace in plugin output, when pkugin is not installed Caused by newly introduces Get-Help check to fetch arguments --- lib/core/tools/ConvertTo-IcingaPowerShellArguments.psm1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/core/tools/ConvertTo-IcingaPowerShellArguments.psm1 b/lib/core/tools/ConvertTo-IcingaPowerShellArguments.psm1 index 4bd93a1..44d983a 100644 --- a/lib/core/tools/ConvertTo-IcingaPowerShellArguments.psm1 +++ b/lib/core/tools/ConvertTo-IcingaPowerShellArguments.psm1 @@ -25,7 +25,12 @@ function ConvertTo-IcingaPowerShellArguments() return @{ }; } - $CommandHelp = Get-Help -Name $Command -Full; + $CommandHelp = Get-Help -Name $Command -Full -ErrorAction SilentlyContinue; + + # Ensure we do not cause exceptions along the border in case the plugin is not installed + if ($null -eq $CommandHelp) { + return @{ }; + } [hashtable]$IcingaArguments = @{ }; [int]$ArgumentIndex = 0;