WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

How To
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Check Which Patches Are Installed


This is handy for testing what revs and patches are already applied to a system.


    #DefineFunction get_rev_data()
    plats = "Other,Windows,Windows for Workgroups,Win32s,Windows NT/2000/XP,Windows 95/98/ME"
    nums = "1,0,2,3"
    w = ItemExtract(WinVersion(4)+1,plats,",")
    For i=1 To 4
      w = ItemInsert(WinVersion(ItemExtract(i,nums,",")),-1,w,".")
    Next i
    qlist = ";"
    ErrorMode(@OFF)
    h1 = RegOpenKey(@REGMACHINE,"Software\Microsoft\Windows\CurrentVersion\Setup\Updates")
    ErrorMode(@ON)
    If h1 <> 0
      l1 = RegQueryKeys(h1)
      For i = 1 To ItemCount(l1,@TAB)
        h2 = RegOpenKey(h1,ItemExtract(i,l1,@TAB))
        l2 = RegQueryKeys(h2)  
        For j = 1 To ItemCount(l2,@TAB)
          h3 = RegOpenKey(h2,ItemExtract(j,l2,@TAB))
          l3 = RegQueryValue(h3,"[]")
            s = ItemExtract(ItemCount(l3," ")-1,l3," ")
            qlist = StrCat(qlist,s,";")
          RegCloseKey(h3)
        Next j
        RegCloseKey(h2)
      Next i
    EndIf
    ErrorMode(@OFF)
    h1 = RegOpenKey(@REGMACHINE,"SOFTWARE\Microsoft\Updates\Windows XP")
    ErrorMode(@ON)
    If h1 <> 0
      l1 = RegQueryKeys(h1)
      For i = 1 To ItemCount(l1,@TAB)
        h2 = RegOpenKey(h1,ItemExtract(i,l1,@TAB))
        l2 = RegQueryKeys(h2)  
        For j = 1 To ItemCount(l2,@TAB)
          qlist = StrCat(qlist, ItemExtract(j,l2,@TAB) ,";")
        Next j
        RegCloseKey(h2)
      Next i
    EndIf
    ErrorMode(@OFF)
    h1 = RegOpenKey(@REGMACHINE,"SOFTWARE\Microsoft\Updates\Windows 2000")
    ErrorMode(@ON)
    If h1 <> 0
      l1 = RegQueryKeys(h1)
      For i = 1 To ItemCount(l1,@TAB)
        h2 = RegOpenKey(h1,ItemExtract(i,l1,@TAB))
        l2 = RegQueryKeys(h2)  
        For j = 1 To ItemCount(l2,@TAB)
          qlist = StrCat(qlist, ItemExtract(j,l2,@TAB) ,";")
        Next j
        RegCloseKey(h2)
      Next i
    EndIf
    Return StrCat(w,",",qlist)
    #EndFunction


Article ID:   W15961
File Created: 2004:03:30:15:42:04
Last Updated: 2004:03:30:15:42:04