Ad Widget

Collapse

Powershell script execution policy

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • miki17
    Junior Member
    • Jun 2018
    • 5

    #1

    Powershell script execution policy

    I don't know if I do something wrong with PowerShell ExecutionPolicy or where is the mistake.

    I have installed Zabbix Agent on my server BRN-APL-02 and here is part of configuration :

    UserParameter=test,powershell -NoProfile -ExecutionPolicy Bypass -File "C:\Program Files\Zabbix Agent\scripts\script.ps1"


    I have all my Powershell scripts signed! My server is in a domain with settings ExecutionPolicy in scope MachinePolicy to AllSigned (Allow only signed scripts).
    If I run command script.ps1 on the BRN-APL-02 server everything is OK. It works.


    But when I want to get userparameter from Zabbix server there is an error

    zabbix@Zabbix:~$ zabbix_get -s BRN-APL-02 -k test
    ZBX_NOTSUPPORTED: Timeout while executing a shell script.

    It is not problem of timeout. I have set option Timeout=30

    When I change Executionpolicy and Scope Machinepolicy in domain to Allow local scripts and remote signed scripts, then command works. But this is not really solution.


    Where could be a problem? Thanks
  • kloczek
    Senior Member
    • Jun 2006
    • 1771

    #2
    If script is running long time it nothing what you can do on zabbix side to improve this.
    If such scripts will be running longer than 30s only way to obtain data out of those scripts is use zabbix trapper items and use zabbix_sender command to feed zabbix results of those scripts.
    http://uk.linkedin.com/pub/tomasz-k%...zko/6/940/430/
    https://kloczek.wordpress.com/
    zapish - Zabbix API SHell binding https://github.com/kloczek/zapish
    My zabbix templates https://github.com/kloczek/zabbix-templates

    Comment

    • miki17
      Junior Member
      • Jun 2018
      • 5

      #3
      I think, script will not run at all. The script can be very easy. For example I want return only hostname.
      The first way doesn't work, but if I run script with lower permissions, it works.

      Comment

      Working...