Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-15988

Zabbix agent will not install under PowerShell function

XMLWordPrintable

      Steps to reproduce:

      I have created a PowerShell script to install Zabbix Agent on a Windows server 2008. I can execute zabbix agent commands whitin CMD with no problem, but when I try to start the "--install -c <configuration_file>"  on my script it fails.

      My script stops and uninstall zabbix agent successfully. But, when I try to install it again, it gives an error showing

      "zabbix_agentd.exe [5952]: unrecognized option `--install --config C:\zabbix\conf\zabbix_agentd.conf'"

      1. I have Zabbix Agent installed on C:\zabbix\
      2. Configuration file is located at C:\zabbix\conf\zabbix_agentd.conf

       

      My script:

       

      $agenteZabbix    = "C:\zabbix\bin\zabbix_agentd.exe"
      
      function PulaLinha {
          timeout /T 1 /NOBREAK > $null
          Write-Host "`n`n"
          }
      
      function ZabbixComando ($comando) {
          & $agenteZabbix $comando
          
          PulaLinha
          }
      
      ZabbixComando -comando '--stop'
      ZabbixComando -comando '--uninstall'
      ZabbixComando -comando '--install --config C:\zabbix\conf\zabbix_agentd.conf'
      ZabbixComando -comando '--start'

       

       

      Result:

      zabbix_agentd.exe [20144]: service [Zabbix Agent] stopped successfully
      
      zabbix_agentd.exe [13196]: service [Zabbix Agent] uninstalled successfully
      zabbix_agentd.exe [13196]: event source [Zabbix Agent] uninstalled successfully
      
      zabbix_agentd.exe [18176]: unrecognized option `--install --config C:\zabbix\conf\zabbix_agentd.conf'
      usage:
        zabbix_agentd.exe [-c config-file]
        zabbix_agentd.exe [-c config-file] -p
        zabbix_agentd.exe [-c config-file] -t item-key
        zabbix_agentd.exe [-c config-file] -i [-m]
        zabbix_agentd.exe [-c config-file] -d [-m]
        zabbix_agentd.exe [-c config-file] -s [-m]
        zabbix_agentd.exe [-c config-file] -x [-m]
        zabbix_agentd.exe -h
        zabbix_agentd.exe -V
      
      zabbix_agentd.exe [15944]: ERROR: cannot open service [Zabbix Agent]: [0x0000042
      4] The specified service does not exist as an installed service.

      Expected:
      When I do it all manually, it gives me no errors

      C:\zabbix\bin>zabbix_agentd.exe --stop
      zabbix_agentd.exe [21260]: service [Zabbix Agent] stopped successfully
      
      C:\zabbix\bin>zabbix_agentd.exe --uninstall
      zabbix_agentd.exe [19888]: service [Zabbix Agent] uninstalled successfully
      zabbix_agentd.exe [19888]: event source [Zabbix Agent] uninstalled successfully
      
      C:\zabbix\bin>zabbix_agentd.exe --install -c C:\zabbix\conf\zabbix_agentd.conf
      zabbix_agentd.exe [5968]: service [Zabbix Agent] installed successfully
      zabbix_agentd.exe [5968]: event source [Zabbix Agent] installed successfully
      
      C:\zabbix\bin>zabbix_agentd.exe --start
      zabbix_agentd.exe [22328]: service [Zabbix Agent] started successfully

            kpavars Kristians Pavars
            markfree MArk
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: