title: Zabbix server 'Action' trying to trigger Host Agent powershell - doesn't run
body: <p>I have some custom User Parameters defined in my Agent config file. These parameters are calling Windows Powershell scripts that I created.</p>
  
  <p>Zabbix Server:  4.4.0</p>
  
  <p>Agent:  4.4.5 (running on Windows Server 2016 Datacenter)</p>
  
  <p>Example UserParameter in the config file:</p>
  
  <pre><code> UserParameter=test.testParams_ps,powershell -noninteractive "C:\Program Files\Zabbix Agent\scripts\Testing\testParams3.ps1"
  </code></pre>
  
  <p>When I activate the Userparameter manually, here are the log results:</p>
  
  <pre><code>&gt; zabbix_get -s 127.0.0.1 -k test.testParams_ps
  ...
  Requested [test.testParams_ps]
  EXECUTE_STR() command:'powershell -noninteractive -file "C:\Program Files\Zabbix Agent\scripts\Testing\testParams.ps1"' len:54 cmd_result:'Executing PS script '
  Sending back [Executing PS script from source = Zabbix server action]
  </code></pre>
  
  <p>However, when I trigger an "Action" on the Zabbix server, which in turn calls the remote Agent on this Host, the Powershell script doesn't actually run.  Here is what the log contains:</p>
  
  <pre><code>Requested [system.run[\Program Files\Zabbix Agent\zabbix_get -s 127.0.0.1 -p 10050 -k test.testParams_ps,nowait]]
  Executing command '\Program Files\Zabbix Agent\zabbix_get -s 127.0.0.1 -p 10050 -k test.testParams_ps'
  zbx_execute_nowait(): executing [cmd /C "\Program Files\Zabbix Agent\zabbix_get -s 127.0.0.1 -p 10050 -k test.testParams_ps"]
  Sending back [1]
  </code></pre>
  
  <p>I thought it might be a permissions issue on the "scripts" sub-folder, but the "System" user has full control over the sub-folders and the script files themselves.</p>
  
  <p>1) I can run the PS script directly on the Host (in a Powershell prompt) - no problems. (Logged into the Host via RDP - using a different account than "System", though.)</p>
  
  <p>2) I can use the Zabbix Agent, via "zabbix_get", to trigger this Key, and the PS script, via a PS command shell running on the local machine - no problems. (Logged in via RDP to the Host, using the same account as in test 1.)</p>
  
  <p>3) Server-side triggered "Action" that calls the Host's Agent, using the same Key: fails to run script, but the attempt to trigger the script DOES show up in the local Agent log on the Host.</p>
  
  <p>There is apparently some disconnect between the Agent and the PS script engine, when that Key is called from a server Action.</p>
  
  <p>Is it possible that it's a Powershell configuration problem? Some flag or setting on the scripts? (I thought I had checked those, and that they were OK - but maybe there is a different one that I'm missing.)</p>
  
  <p>Have checked:</p>
  
  <p>• Get-ExecutionPolicy</p>
  
  <p>• Unblock-file</p>
  
  <p>Does anyone have some hints on what to check or investigate?</p>
  
  <p>Thanks.</p>