NagiosEnterprises / ncpa

Nagios Cross-Platform Agent
Other
177 stars 95 forks source link

Run a Powershell script that requires a parameter which is a path to be passed with spaces #829

Open riahc3 opened 2 years ago

riahc3 commented 2 years ago

Hello

I have a Powershell script that requires me to pass two parameters; One of them is a path with spaces.

NCPA API gives me the following:

./check_ncpa.py -H localhost -t '' -M 'plugins/check_userid_logfile_errors.ps1' -q 'args=-LogFile 'C:\Program Files (x86)\A folder Somewhere\Another folder\One-More Folder\SomethingElse.log.log',args=-ErrorText '115''

It works in the API but when I copy and paste the exact thing (hardcoding things like the host, token, etc) it gives me a error finding the path.

Its not a script issue as I run the script and it works fine.

It also seems like something "refreshing" the script doesnt work. I put a simple Write-Host "Hello World" exit 0 and rerun it and it shows me the previous result.

How can I call this script using NCPA?

Thank you

ccztux commented 2 years ago

Maybe modifying your powershell script like described here could solve this issue.