Ad Widget

Collapse

Custom User Parameter: how to include a space in the script path

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • J_Adatasol
    Member
    • Dec 2018
    • 74

    #1

    Custom User Parameter: how to include a space in the script path

    Hey all,

    This seems simple, but has been eluding me. I have tried various things, but can't seem to get it working.

    I have some custom User Parameters defined in my Agent config file. These parameters are calling Windows Powershell scripts that I created, and that are located inside the Zabbix installation folder. The path to this folder has a space in it, though. So when I try to call these scripts, I get an error back - it seems that the space in the path is tripping up Powershell.

    Installation path (space in two places, "Program Files" and "Zabbix Agent"):
    "C:\Program Files\Zabbix Agent\scripts\Testing\testParams3.ps1"
    Example UserParameter in the config file:
    UserParameter=test.testParams_ps,powershell -noninteractive "C:\Program Files\Zabbix Agent\scripts\Testing\testParams3.ps1"
    Command and resulting error:
    C:\Users\Blah> zabbix_get -s 127.0.0.1 -k test.testParams_ps
    C:\Program : The term 'C:\Program' is not recognized as the name of a cmdlet, ...
  • J_Adatasol
    Member
    • Dec 2018
    • 74

    #2
    DOH! 15 more minutes of testing - I realized that I was not including the "-file" flag in my Powershell call. It should look like this:

    Code:
    UserParameter=test.testParams_ps,powershell -noninteractive -file "C:\Program Files\Zabbix Agent\scripts\Testing\testParams3.ps1"

    Comment

    Working...