This script was been created to monitor Windows servers for available updates by the Zabbix system.
The script uses only the Windows Update API. (https://docs.microsoft.com/en-us/windows/desktop/api/wuapi/nf-wuapi-iupdatesearcher-search).
The script checks the number of all available updates, and only the important types of updates separately (according to https://blogs.technet.microsoft.com/dubaisec/2016/01/28/windows-update-categories/).
OS: Windows Server 2008, 2012, 2016
Zabbix : 5.0
The script can be used in two ways:
- Specify macroses
{$ZSENDER}(full path to thezabbix_sender.exe) and{$ZPATH}(full path tothe zabbix_agentd.conf) in the zabbix-node. - Do not specify macros. Then it will automatically search for files zabbix_sender.exe and zabbix_agentd.conf.
The search is performed recursively in each parent folder starting from the script parent folder.
F.e., if the absolute path of the script file is c:\Program Files\Zabbix Agent\plugins\zbx.winupdate.vbs, then:
- search for files in the
c:\Program Files\Zabbix Agent\plugins\directory; - if no files are found, check in the
c:\Program Files\Zabbix Agent\directory; - if no files are found, check in the
c:\Program Files\directory; - if no files are found, check in the
c:\directory.
- Distribute the
zbx.winupdate.vbsfile to the required machines. - Make sure that
EnableRemoteCommand=1andAllowKey=system.run[*]is enabled inzabbix_agentd.conf. - Import the
template_windows_update_vbs.xmltemplate. - Specify the paths to
zabbix_sender.exeandzabbix_agentd.win.confby the macroses{$ZSENDER}and{$ZPATH}respectively on each zabbix-node.
- Distribute the
zbx.winupdate.vbsandwinupdateSearchCheck.vbsfile to the required machines. - Run the script
winupdateSearchCheck.vbsmanually: make sure the automatic files search is successful. - Make sure that
EnableRemoteCommand=1andAllowKey=system.run[*]is enabled inzabbix_agentd.conf. - Import the
template_windows_update_vbs.xmltemplate.
Instead of the AllowKey=system.run[*], you can specify permission to run a specific script only. Detailed information on how to do this is available here.
All items are divided into 2 groups: Winupdates vbs and Winupdates vbs panel. You can create a panel with a convenient display of the current status of available updates on the servers.
To do this, you need to create a widget Data overview on the dashboard, in the application field specify Winupdates vbs panel.
See panel_example.jpg.