Get pending windows updates status on ZABBIX using custom LLD (Low Level Discovery) and PowerShell

Just recently I got some time, and was rethinking the solution of reading windows updates.

At the beginning I thought I will use PowerShell to get update list and later use dependent items to parse the script output, but this wouldn’t be so nice, as I would need to manually work on parsing the file on the zabbix side, create items etc. + so far zabbix does not offer (I work on 3.4, at the time being 4.0 available) LLD on dependent items.

Well, why not use current LLD to read them?


You can do it – I will show you how.

First you need to increate yout timeout for scripts from the default 3 to 30 seconds, remember to restart the zabbix-server service after that.

Then, you need to have this PowerShell script:

Put it as your userparameter like this:

UserParameter=GetPendingUpdates[*],%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -nologo -command “& ‘c:\Program Files\Zabbix Agent\scripts\ZBX_GetPendingUpdates.ps1’ $1”

Now create template with dicovery rule:


Discovery rule:
Name: GetAllPendingUpdates
Type: Zabbix agent
Key: GetPendingUpdates[{$GETUPDATESTATE}]
{$GETUPDATESTATE} is defined in my case at the template level like this: Updates:Security-Updates

This GETUPDATESTATE need to be like that as Zabbix does not allow for many special characters in the parameters, this will be parsed later in the userparameter script so don’t worry. Just remember that “:” divides types of updates, and “-” is for space, so eventually Updates:Security-Update equals “Updates”,”Security Update” in the script.


You can test it with zabbix_get:

$ zabbix_get -s -k GetPendingUpdates[Updates:Security-Updates:Windows-10]

“{#UPNAME}”: “Updates”,
“{#UPNUMBER}”: 3
“{#UPNAME}”: “Security Updates”,
“{#UPNUMBER}”: 20
“{#UPNAME}”: “Windows 10”,
“{#UPNUMBER}”: 0

Now create an item prototype:


Item prototype:
Name: Number of pending “{#UPNAME}” updates
Type: Calculted
Formula: {#UPNUMBER}

After few minutes you will get:



3 thoughts on “Get pending windows updates status on ZABBIX using custom LLD (Low Level Discovery) and PowerShell

  1. Hi Pawel

    Thank you for that nice and easy solution. I just found one error regarding the item prototype. It should be
    as you will get an error message when more than one type of updates has the same amount of pending updates, especially when they are all 0.


    1. Hey!

      Well, just checked our production if I made any changes after that – for me it work well with “UPNUMBER[{#UPNUMBER}]”.

      I show what updates I check in “Number of pending “{#UPNAME}” updates” so the name of the item, and the number of the item is showed in the actual value.


  2. Hi Pafcio,
    It’s any change to improve your ps scripts for w2k3 (for rest works perfecto!)
    [root@SCMWRK03 ~]# zabbix_get -s xx.xx.xx.xx -k GetPendingUpdates[Updates:Security-Updates]

    Unexpected token ‘in’ in expression or statement.

    At C:\Program Files\Zabbix Agent\scripts\ZBX_GetPendingUpdates.ps1:24 char:26

    + if ($ in <<<< $AllUpdates){

    + CategoryInfo : ParserError: (in:String) [], ParseException

    + FullyQualifiedErrorId : UnexpectedToken


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s