mickem / nscp

NSClient++
http://nsclient.org
GNU General Public License v2.0
240 stars 94 forks source link

Execute signed powershell scripts #277

Open scoopy2611 opened 8 years ago

scoopy2611 commented 8 years ago

Hi guys,

i try to execute signed powershell scripts via check_nrpe. The executionpolicy is set to AllSigned and the script is signed with a valid certificate. When i execute the script within the powershell console, it runs without any problems. This is my nsclient config:

[/settings/external scripts/scripts] check_backup = cmd /c echo scripts\check_backup.ps1; exit($lastexitcode) | powershell.exe -noprofile -command -

Thats the return value when i execute check_nrpe on the server check_nrpe -H server -c check_backup

AuthorizationManager check failed. At line:1 char:25

Set the executionpolicy to remotesigend is no option. Any ideas?

best regards, scoopy

mickem commented 8 years ago

Try ignoring al lthe fancy stuff and just use the script as-is:

; TODO
[/settings/external scripts/scripts]

test_ps = powershell scripts\check_test.ps1 $ARG1$ hej hej
test_ps aaa
D ext-script Command line: powershell scripts\check_test.ps1 aaa hej hej
L        cli OK: Test arguments are: (aaa "hej" "hej")
test_ps warn
D ext-script Command line: powershell scripts\check_test.ps1 warn hej hej
L        cli WARNING: Test arguments are: (warn "hej" "hej")