|
69 | 69 | .NOTES |
70 | 70 | #> |
71 | 71 |
|
| 72 | +[string]$PsBaseCArg = [string]::Format('try {{ Use-Icinga -Minimal; }} catch {{ Write-Output {0}The Icinga PowerShell Framework is either not installed on the system or not configured properly. Please check https://icinga.com/docs/windows for further details{0}; Write-Output {0}Error:{0} $$($$_.Exception.Message)Components:`r`n$$( Get-Module -ListAvailable {0}icinga-powershell-*{0} )`r`n{0}Module-Path:{0}`r`n$$($$Env:PSModulePath); exit 3; }}; Exit-IcingaExecutePlugin -Command {0}$ifw_api_command${0} ', "'"); |
| 73 | + |
72 | 74 | function Get-IcingaCheckCommandConfig() |
73 | 75 | { |
74 | 76 | param( |
@@ -114,6 +116,10 @@ function Get-IcingaCheckCommandConfig() |
114 | 116 | 'order' = '-1'; |
115 | 117 | 'value' = '$IcingaPowerShellBase_String_ExecutionPolicy$'; |
116 | 118 | }; |
| 119 | + '-C' = @{ |
| 120 | + 'order' = '0'; |
| 121 | + 'value' = $PsBaseCArg; |
| 122 | + }; |
117 | 123 | }; |
118 | 124 | 'command' = 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'; |
119 | 125 | 'disabled' = $FALSE; |
@@ -201,13 +207,7 @@ function Get-IcingaCheckCommandConfig() |
201 | 207 | # Add command Structure |
202 | 208 | $Basket.Command.Add( |
203 | 209 | $check, @{ |
204 | | - 'arguments' = @{ |
205 | | - # Set the Command handling for every check command |
206 | | - '-C' = @{ |
207 | | - 'value' = [string]::Format('try {{ Use-Icinga -Minimal; }} catch {{ Write-Output {1}The Icinga PowerShell Framework is either not installed on the system or not configured properly. Please check https://icinga.com/docs/windows for further details{1}; Write-Output {1}Error:{1} $$($$_.Exception.Message)Components:`r`n$$( Get-Module -ListAvailable {1}icinga-powershell-*{1} )`r`n{1}Module-Path:{1}`r`n$$($$Env:PSModulePath); exit 3; }}; Exit-IcingaExecutePlugin -Command {1}{0}{1} ', $check, "'"); |
208 | | - 'order' = '0'; |
209 | | - }; |
210 | | - } |
| 210 | + 'arguments' = @{ } |
211 | 211 | 'fields' = @(); |
212 | 212 | 'imports' = @( 'PowerShell Base' ); |
213 | 213 | 'object_name' = $check; |
@@ -694,6 +694,10 @@ function Write-IcingaPlainConfigurationFiles() |
694 | 694 | $PowerShellBase += [string]::Format(' ]{0}', (New-IcingaNewLine)); |
695 | 695 | $PowerShellBase += [string]::Format(' timeout = 3m{0}', (New-IcingaNewLine)); |
696 | 696 | $PowerShellBase += [string]::Format(' arguments += {{{0}', (New-IcingaNewLine)); |
| 697 | + $PowerShellBase += [string]::Format(' "-C" = {{{0}', (New-IcingaNewLine)); |
| 698 | + $PowerShellBase += [string]::Format(' order = 0{0}', (New-IcingaNewLine)); |
| 699 | + $PowerShellBase += [string]::Format(' value = "{0}"{1}', $PsBaseCArg, (New-IcingaNewLine)); |
| 700 | + $PowerShellBase += [string]::Format(' }}{0}', (New-IcingaNewLine)); |
697 | 701 | $PowerShellBase += [string]::Format(' "-ExecutionPolicy" = {{{0}', (New-IcingaNewLine)); |
698 | 702 | $PowerShellBase += [string]::Format(' order = -1{0}', (New-IcingaNewLine)); |
699 | 703 | $PowerShellBase += [string]::Format(' value = "$IcingaPowerShellBase_String_ExecutionPolicy$"{0}', (New-IcingaNewLine)); |
|
0 commit comments