I’ve made a script to update all the Zabbix agents on Windows servers in a domain. The script does the following:

  1. Qeries Active Directory and searches for all Windows Servers in a Domain.
  2. Tests for each remote server queried by Active Directory if the specified folder. exists on the defined path.
  3. If the path exists it will stop the defined service.
  4. It will then rename the specified file on the target directory as a backup.
  5. Next it will copy all files from the repository location to the target path.
  6. Finally, it starts the service again when the files have finished copying.

For this script to function properly, you need the following:

  1. Windows PowerShell Version 3 on the server that will execute the script
  2. The Active Directory module for Windows PowerShell installed on the server that will execute the script.
  3. The Zabbix Agent source files downloaded and stored on a central location or fileshare that all servers can access using the credentials of the account that executes the script. This should be an administrator account. You can download the latest Zabbix agent for Windows here.

Important: You should only replace the executable files in the agent folder, thus only put these files in the source location. The files are zabbix_agent.exe, zabbix_get.exe and zabbix_sender.exe.
(You do not want to replace your existing .conf file with the default .conf file)

Without further ado, here’s the script:

 

Email this to someoneTweet about this on TwitterShare on FacebookShare on Google+Share on LinkedInDigg thisPin on Pinterest
  1. That’s all! Just assure that your windows host Status is set to Enabled and wait a few minutes in order for Zabbix server to contact the windows agent side and process the received remote data.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">