[ZBX-22865] zabbix_agent2 on windows UserParameter: cannot run executable found relative to current directory Created: 2023 May 30  Updated: 2024 Dec 03  Resolved: 2023 Jun 08

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Agent (G)
Affects Version/s: None
Fix Version/s: None

Type: Incident report Priority: Trivial
Reporter: Anton Kozlov Assignee: Tomass Janis Bross
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Windows server 2016 standard 1607, zabbix-agent2


Issue Links:
Duplicate

 Description   

Steps to reproduce:

add to configuration file

UserParameter=zaza[*],powershell write-host "PREVED $1"

Result:

 

# zabbix_get -s 10.205.255.213 -k 'zaza[MEDVED]'
ZBX_NOTSUPPORTED: Cannot execute command: exec: "cmd": cannot run executable found relative to current directory

 

Expected:

# zabbix_get -s 10.205.255.213 -k 'zaza[MEDVED]'
PREVED MEDVED

 

If I start agent2 in foreground(at console) - problem not exists(I get valid responce). Problem exists only when agent2 installed and started as a windows service.

 

Testing on different agent2 versions with the same configfile on this host. Problem was found at agent2 6.0.13 version and newer:

# zabbix_get -s 10.205.255.213 -k 'zaza[MEDVED]' ; zabbix_get -s 10.205.255.213 -k 'agent.version'
PREVED MEDVED
6.0.0
# zabbix_get -s 10.205.255.213 -k 'zaza[MEDVED]' ; zabbix_get -s 10.205.255.213 -k 'agent.version'
PREVED MEDVED
6.0.9
# zabbix_get -s 10.205.255.213 -k 'zaza[MEDVED]' ; zabbix_get -s 10.205.255.213 -k 'agent.version'
PREVED MEDVED
6.0.11
# zabbix_get -s 10.205.255.213 -k 'zaza[MEDVED]' ; zabbix_get -s 10.205.255.213 -k 'agent.version'
PREVED MEDVED
6.0.12
# zabbix_get -s 10.205.255.213 -k 'zaza[MEDVED]' ; zabbix_get -s 10.205.255.213 -k 'agent.version'
ZBX_NOTSUPPORTED: Cannot execute command: exec: "cmd": cannot run executable found relative to current directory
6.0.13
# zabbix_get -s 10.205.255.213 -k 'zaza[MEDVED]' ; zabbix_get -s 10.205.255.213 -k 'agent.version'
ZBX_NOTSUPPORTED: Cannot execute command: exec: "cmd": cannot run executable found relative to current directory
6.0.17

Full configfile

 

Server=10.205.255.78,127.0.0.1
ServerActive=10.205.255.78
Hostname=tech-exch01
LogFile=c:\Program Files\Zabbix-Agent2\zabbix_agent2.log
LogFileSize=1
LogType=file
DebugLevel=4
Timeout=20
UnsafeUserParameters=1
Plugins.SystemRun.LogRemoteCommands=1
Plugins.Log.MaxLinesPerSecond=20
UserParameter=zaza[*],powershell write-host "PREVED $1"

 

 

log:

2023/05/30 11:15:28.576299 received passive check request: 'zaza[MEDVED]' from '10.205.255.78'
2023/05/30 11:15:28.576299 [1] processing update request (1 requests)
2023/05/30 11:15:28.577288 [1] adding new request for key: 'zaza[MEDVED]'
2023/05/30 11:15:28.577288 [1] created direct exporter task for plugin 'UserParameter' itemid:0 key 'zaza[MEDVED]'
2023/05/30 11:15:28.577288 executing direct exporter task for key 'zaza[MEDVED]'
2023/05/30 11:15:28.577288 [UserParameter] executing command:'powershell write-host "PREVED MEDVED"'
2023/05/30 11:15:28.577288 failed to execute direct exporter task for key 'zaza[MEDVED]' error: 'Cannot execute command: exec: "cmd": cannot run executable found relative to current directory'
2023/05/30 11:15:28.578292 sending passive check response: ZBX_NOTSUPPORTED: 'Cannot execute command: exec: "cmd": cannot run executable found relative to current directory' to '10.205.255.78'

 

 

 



 Comments   
Comment by Tomass Janis Bross [ 2023 Jun 08 ]

Hello Anton!
Thank you for reporting this issue!

This issue has already been reported here: https://support.zabbix.com/browse/ZBX-22765 And a fix has also been found. The fix should be released with the upcoming Agent2 minor release 6.0.19.
As for a workaround for now - starting the Agent2 with a privileged user will fix the issue.

Closing this as a duplicate of: https://support.zabbix.com/browse/ZBX-22765

Generated at Tue Jul 22 08:39:58 EEST 2025 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.