Page 1 of 1

powershell script with directory path as argument

Posted: Sat Feb 21, 2015 7:15 pm
by ruffsense
Hi,

I have created my own powershell check file exsist script. But Im stuck when i use arguments. If i use a path as an argument. lik: D:\Temp\Center\ it won’t work. If i add the path to my script and the other arguments it works.

Is it not possible to add paths as an argument.

The line in the nsclient.ini is:

check_file_crm = cmd /c echo scripts\check_file.ps1 $ARG1$ $ARG2$ $ARG3$; exit ($lastexitcode) | powershell.exe -command –

To test the file i do it from my nagios server../check_nrpe -n -H 10.X.X.X -C check_file_crm -a D:\Temp\Center\ test.txt 60

Re: powershell script with directory path as argument

Posted: Sun Feb 22, 2015 4:52 pm
by Box293
I'm pretty sure you need to use double backslahes in the path:

Code: Select all

./check_nrpe -n -H 10.X.X.X -C check_file_crm -a D:\\Temp\\Center\\ test.txt 60