Ad Widget

Collapse

Agent2 v7.0.0 command line MSI installation - reg query parameter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • boogedy
    Junior Member
    • Nov 2020
    • 11

    #1

    Agent2 v7.0.0 command line MSI installation - reg query parameter

    i,

    Please kindly assist, how to make MSI installation command line, where this parameter is included:

    ALLOWDENYKEY="AllowKey=system.run[reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersio n\Wi ndowsUpdate\Auto Update" | find /C "RebootRequired"]"

    Problem is, that syntax does not accept such complex command and Zabbix instructions here, does not help:
    https://www.zabbix.com/documentation...ted-parameters
    ALLOWDENYKEY Sequence of "AllowKey" and "DenyKey" parameters separated by ;
    Use \\; to escape the delimiter.
    Example: ALLOWDENYKEY="AllowKey=system.run[type c:\windows\system32\drivers\etc\hosts];DenyKey=system.run[*]"
    Problem is, that command like that, does not work:

    msiexec /l*v log.txt /i "zabbix_agent2-7.0.0-windows-amd64-openssl.msi" HOSTNAME=myHost^ SERVER=xxx LISTENPORT=10050 SERVERACTIVE=xxx:10051 ALLOWDENYKEY="AllowKey=system.run[reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersio n\Wi ndowsUpdate\Auto Update" | find /C "RebootRequired"]" /qb

    Additionally, please kindly assist, how to write properly this part:
    HOSTNAME=myHost^ - so that after MSI installation, proper hostname is written in Zabbix configuration file.

    Thanks beforehand!

    Last edited by boogedy; 13-06-2024, 23:16.
  • jhboricua
    Senior Member
    • Dec 2021
    • 113

    #2
    If I have to guess, your ALLOWDENYKEY value is causing the issue because you have multiple double quotes in it. Use single quotes to enclose the HKLM string and the RebootRequired strings in it, leaving the double quotes to enclose only the value of ALLOWDENYKEY.

    As for the HOSTNAME parameter, what exactly is the problem with it?

    Comment

    • boogedy
      Junior Member
      • Nov 2020
      • 11

      #3
      Hi,

      Thanks for your answer.

      --
      1.

      Seems ALLOWDENYKEY requires also DenyKey. If not defined DenyKey, then I got a problem.

      Click image for larger version

Name:	denykey-was-not-defined.png
Views:	480
Size:	61.0 KB
ID:	485740

      New command looks like:
      msiexec /l*v log.txt /i "zabbix_agent2-7.0.0-windows-amd64-openssl.msi" SERVER=xxx LISTENPORT=10050 SERVERACTIVE=xxx:10051 ALLOWDENYKEY="AllowKey=system.run[reg query 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Wi ndowsUpdate\Auto Update' | find /C 'RebootRequired'];DenyKey=*" /qb

      New problem appeared:
      in configuration file, this line looks like that:

      Click image for larger version

Name:	query.png
Views:	394
Size:	105.9 KB
ID:	485741

      AllowKey=system.run[reg query 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Wi ndowsUpdate\Auto Update' | find /C 'RebootRequired']
      and in Windows - this command does not work. It requires this command with doublequotes:
      AllowKey=system.run[reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Wi ndowsUpdate\Auto Update" | find /C "RebootRequired"]

      Click image for larger version

Name:	windows.png
Views:	398
Size:	35.4 KB
ID:	485742

      Another quite stupid situation is, that as soon you define DenyKey=*, then your Host Discovery - just does not work.
      I am using template: 'Windows by Zabbix agent active'.

      --
      2.
      'As for the HOSTNAME parameter, what exactly is the problem with it?' -
      My target is to prepare MSI silent installation for "zabbix_agent2-7.0.0-windows-amd64-openssl.msi", so that after installation is done - you open zabbix config file on server and there is defined parameter: HOSTNAME=myservernamehere. I am unable to achieve that. Maximum, what I am able - to define HOSTNAME=blabla.

      I tried this command, it does not work:
      msiexec /l*v log.txt /i "zabbix_agent2-7.0.0-windows-amd64-openssl.msi" HostnameItem=system.hostname SERVER=xxx LISTENPORT=10050 SERVERACTIVE=xxx:10051 ALLOWDENYKEY="AllowKey=system.run[reg query 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Wi ndowsUpdate\Auto Update' | find /C 'RebootRequired'];DenyKey=*"

      Comment

      • jhboricua
        Senior Member
        • Dec 2021
        • 113

        #4
        You have a space in your command on the registry key path on 'WindowsUpdate' (can also be seen in the command prompt screenshot). In your post it shows 'Wi ndowsUpdate'. Not sure if that's the cause of your problem.

        Have you tried flipping the single/double quotes in the ALLOWDENYKEY parameter on your MSI command?

        Code:
        ALLOWDENYKEY='AllowKey=system.run[reg query "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" | find /C "RebootRequired"];DenyKey=*'
        Also HostnameItem is not a valid parameter for the MSI installer. You could try HOSTMETADATAITEM=system.uname instead.
        Last edited by jhboricua; 01-08-2024, 06:56.

        Comment

        Working...