Ad Widget

Collapse

Determine the status of Windows Updates configuration

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Determine the status of Windows Updates configuration

    Hello,
    Problem I have is remote computers are automatically downloading updates and rebooting.
    I have been looking to find a way to get data from my Windows update configuration.not to be confuse on what updates are available.
    I'm running Zabbix server 2.4
    Zabbix agents are on Windows 7/8.1 and Windows Server 2012 R2
    For an example;
    Is my Windows Update setting set to;
    "Install update automatically( recommended)"
    "Download updates but let me choose whether to install them"
    Places that I have looked;
    github.com/jjmartres/Zabbix/tree/master/zbx-templates/zbx-windows/zbx-windows-envmon
    zabbix.org/wiki/Monitoring_Windows_Updates
    www.zabbix.com/forum/showthread.php?t=46960

    Or if there is something I missed and maybe guide me to the right direction.
    Thank in advance.
    Last edited by Gsmith; 03-12-2015, 08:04.

    #2
    Still Working on it

    I came across this VbScript,
    ' Name: AUChange.vbs
    ' Function: Change the setting for Windows (Automatic) Update
    ' Usage: AUChange ()
    ' Returns: Output according to 1 - 4:
    ' 1 "Never check for updates"
    ' 2 "Check for updates but let me choose whether to download and install them"
    ' 3 "Download updates but let me choose whether to install them"
    ' 4 "Install updates automatically"



    Dim AUSetting
    args = Wscript.Arguments.Count
    AUSetting = WScript.Arguments.Item(0)

    if IsNumeric(AUSetting) Then
    'A number was passed in
    if AUSetting > 4 then
    wscript.echo(AUSetting & " is an incorrect value. You must indicate a value 1 - 4. See script for value explanations")
    wscript.Quit(10001)
    end if
    else
    wscript.echo(AUSetting & " is an incorrect argument(s). You must indicate one argument with a value 1 - 4. See script for values")
    wscript.Quit(10001)
    end If

    Set objAutoUpdate = CreateObject("Microsoft.Update.AutoUpdate")
    Set objSettings = objAutoUpdate.Settings

    objSettings.NotificationLevel = AUSetting
    objSettings.Save

    If AUSetting = "1" then
    wscript.echo("Windows Update has been disabled")
    wscript.Quit(0)
    elseIf AUSetting = "2" then
    wscript.echo("Check for updates but let me choose whether to download and install them")
    wscript.Quit(0)
    elseIf AUSetting = "3" then
    wscript.echo("Download updates but let me choose whether to install them")
    wscript.Quit(0)
    else
    wscript.echo("Install updates automatically")
    wscript.Quit(0)
    end If

    Using this to run the script;
    C:\cscript //NoLogo "C:\Program Files (x86)\Zabbix Agent\Scripts\AUChange.vbs"
    I received a error after running this script;
    C:\Program Files (x86)\Zabbix Agent\Scripts\AUChange.vbs(14, 2) Microsoft VBScript runtime error: Subscript out of range
    I think this would be from line 14.
    I looked here for help>> http://classicasp.aspfaq.com/general...ge-errors.html
    So i tried changing the number (0) to 1, -1 ,2,3 etc... Nothing worked, unfortunately I'm not so good at coding.

    Any help would be appreciated.

    Comment


      #3
      Well solve my problem.. I can change my WU setting by adding 1-4 number at the end on of;
      C:\cscript //NoLogo "C:\Program Files (x86)\Zabbix Agent\Scripts\AUChange.vbs" <1-4>
      Still trying to figure out what Windows update settings is currently on my windows server and send it to Zabbix server.

      Comment


        #4
        I'm Getting Closer

        Found Another script that does display what setting Windows Update is configured. I tested it on Windows Server 2012 R2 and it works good. The only problem I'm having now is how Zabbix server can get this information.

        Script for determining the state of Windows Update;

        Set objAutoUpdate = CreateObject("Microsoft.Update.AutoUpdate")
        Set objSettings = objAutoUpdate.Settings

        Select Case objSettings.NotificationLevel
        Case 0
        Wscript.Echo "Notification level: Automatic Updates is not configured by the user " & _
        "or by a Group Policy administrator."
        Case 1
        Wscript.Echo "Notification level: never check for updates(not recommended)."
        Case 2
        Wscript.Echo "Notification level: Automatic Updates prompts users to approve updates " & _
        "before downloading or installing."
        Case 3
        Wscript.Echo "Notification level: install updates automatically(recommended)."
        Case 4
        Wscript.Echo "Notification level: Download updates but let me choose whether to install them."
        Case Else
        Wscript.Echo "Notification level could not be determined."
        End Select
        I opened to any ideas.

        Comment


          #5
          I Did It!!!

          Lab Setup;
          Zabbix Server 2.4.4 on Centos 6.6
          Zabbix Agent Windows Server 2012 R2 (add to host list on Zabbix server)
          Dropped the firewalls
          Install the script in Windows Server 2012 R2;
          Set objAutoUpdate = CreateObject("Microsoft.Update.AutoUpdate")
          Set objSettings = objAutoUpdate.Settings
          Select Case objSettings.NotificationLevel
          Case 0
          Wscript.Echo "Notification level: Automatic Updates is not configured by the user " & _
          "or by a Group Policy administrator."
          Case 1
          Wscript.Echo "Notification level: never check for updates(not recommended)."
          Case 2
          Wscript.Echo "Notification level: Automatic Updates prompts users to approve updates " & _
          "before downloading or installing."
          Case 3
          Wscript.Echo "Notification level: install updates automatically(recommended)."
          Case 4
          Wscript.Echo "Notification level: Download updates but let me choose whether to install them."
          Case Else
          Wscript.Echo "Notification level could not be determined."
          End Select
          I put the script here>>
          C:\Program Files (x86)\Zabbix Agent\Scripts\autoupdate_setting.VBS
          Tested the script on windows CMD;
          C:\ cscript //NoLogo "C:\Program Files (x86)\Zabbix Agent\Scripts\autoupdate_setting.vbs"
          Works!!
          So I configured an “Item” on Zabbix server
          <install text for Windows agent config>

          Name= Windows Update Settings
          Type= Zabbix Agent(active)
          Key= autoupdate_settings[“$1”]
          Type of information=log
          Update interval=30
          History storageperiod=90
          Application= Windows Update(s)
          I forgot to say that on my zabbix agent config file i used;
          UserParameter=custom.autoupdate_setting[*],cscript //NoLogo "C:\Program Files (x86)\Zabbix Agent\Scripts\autoupdate_setting.vbs" $1
          That was it, now through “latest data I can see how each machine is configured and what the last update was. I hope this data can help someone. Wow great feeling
          Last edited by Gsmith; 03-12-2015, 08:04.

          Comment


            #6
            Still Testing

            Here is my end Product, just some screen shots of;
            1. Windows update Settings
            2. Windows Update full,this list Priority and Optional updates that are ready to be installed
            3. last time that Windows Updates was run.
            4. total number of updates that are available for installation. sum of optional and priority
            Had to fine tune zabbix agent on windows,
            1. UnsafeUserParameters=1
            2. UserParameter=update.autoupdate_setting[*],cscript //NoLogo "C:\Program Files (x86)\Zabbix Agent\autoupdate-settings.vbs" $1
            Take a 10-15 minutes to start collecting data.
            Trending data for a hour with the update interval set for 30 seconds.
            Create a trigger for "Priority Updates" needed.
            Hope this helps.
            Last edited by Gsmith; 03-12-2015, 08:03.

            Comment

            Announcement

            Collapse
            No announcement yet.
            Working...
            X