Ad Widget

Collapse

check for windows updates

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • colin7151
    Junior Member
    • Oct 2006
    • 9

    #1

    check for windows updates

    Hey guys,

    Dose anyone have any ideas how I could set it up so the agent did a check to see if there were any outstanding windows updates that needed to be isntalled on the box it was installed on?

    Im use to a *nix enviorment so im not sure how to do this on windows, i googled around but couldnt fine anything all that helpfull.
  • LEM
    Senior Member
    Zabbix Certified Specialist
    • Sep 2004
    • 112

    #2
    Perhaps wupdmgr.exe has usefull commande line switches (I have no winbox here to check) that you could parse with a short shell script (wsh, vb, ...), use in a UserParameter (or system.run) ?
    --
    LEM

    Comment

    • colin7151
      Junior Member
      • Oct 2006
      • 9

      #3
      Originally posted by LEM
      Perhaps wupdmgr.exe has usefull commande line switches (I have no winbox here to check) that you could parse with a short shell script (wsh, vb, ...), use in a UserParameter (or system.run) ?
      Yeah that would be cool, however i have not been able to find a way to get anything useful out of wupdmgr.exe.

      Dose anyone have experience doing such a thing, or know if its even possible?

      Comment

      • peter_field
        Member
        • Jun 2006
        • 71

        #4
        Workaround...

        I would like something like this also. However, I have currently settled for this solution:


        I just trigger when Windows Updates haven't been installed for 60 days. Not as nice as having a count of outstanding updates, but I don't have time to be poking around with this. I imagine if you need a specific count, you would have to query WSUS database directly, or parse the client logs (yuk). Perhaps WMI might have something?

        A quick google has revealed:


        Good luck.

        Comment

        • eger
          Member
          • Nov 2006
          • 95

          #5
          I was looking for this also and found some code on Microsoft here: http://www.microsoft.com/technet/scr....mspx?mfr=true

          This code is able to get all the information on the updates (even installed). I modified it to trim and add a couple things to get the numbers needed. This could be modified further to just spit out just the number of updates, high priority, or optional. I will reply back again when I have this working as a trigger to test against the number. This should be possible to add as a userparameter and run with cscript to get the output.

          Code:
          Set objSearcher = CreateObject("Microsoft.Update.Searcher")
          Set objResults = objSearcher.Search("IsInstalled=0")
          Set colUpdates = objResults.Updates
          
          updatesHigh = 0
          updatesOptional = 0
          
          For i = 0 to colUpdates.Count - 1
          
          
          	If (colUpdates.Item(i).IsInstalled = False AND colUpdates.Item(i).AutoSelectOnWebSites = False) Then
          		updatesOptional = updatesOptional + 1
          		title = "Optional Update"
          	ElseIf (colUpdates.Item(i).IsInstalled = False AND colUpdates.Item(i).AutoSelectOnWebSites = True) Then
          		updatesHigh = updatesHigh + 1
          		title = "High Priority Update"
          	End IF
          
              Wscript.Echo title & ": " & colUpdates.Item(i).Title
              
          Next
          
          Wscript.Echo
          Wscript.Echo "Available Updates: " & (updatesHigh + updatesOptional)
          Wscript.Echo "High Priority Updates: " & updatesHigh
          Wscript.Echo "Optional Updates: " & updatesOptional
          Test it by running in command line as: cscript <script_file_name>

          Hope this is useful to someone

          Comment

          • eger
            Member
            • Nov 2006
            • 95

            #6
            I put this together to get me some items which show the count for available windows updates for use in triggers. You can find more information in the new thread I started at: http://www.zabbix.com/forum/showthread.php?p=49498

            Comment

            Working...