Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account


Photo

How to list all currently installed Win7 patches/updates?


  • Please log in to reply
23 replies to this topic

#1
msoff20xx

msoff20xx

    Newbie

  • Member
  • 15 posts
  • OS:none specified
  • Country: Country Flag
How can I list which of the available Win7 patches/updates from Microsoft are currently really applied and installed on the local Win7 system?

The list of patches/updates should cover updates for Offcie 2003/2007 as well.

How can I list the information?

Peter


How to remove advertisement from MSFN

#2
cluberti

cluberti

    Gustatus similis pullus

  • Supervisor
  • 11,247 posts
  • OS:Windows 8.1 x64
  • Country: Country Flag
This is easy to do in VBScript or Powershell, but since VBScript is a little easier to understand and will work (relatively speaking) downlevel on stock XP/2003 and 2000 SP3 systems as well, I'll do it in VBScript:

'// Run with cscript:
RunMeWithCScript()


'// Connect to the Windows Update COM object:
Set objSession = CreateObject("Microsoft.Update.Session")
Set objSearcher = objSession.CreateUpdateSearcher
intHistoryCount = objSearcher.GetTotalHistoryCount

'// Get WU history data:
Set colHistory = objSearcher.QueryHistory(1, intHistoryCount)

'// Loop through and print to screen:
For Each objEntry in colHistory
    WScript.Echo "=============================="
    WScript.Echo objEntry.Title
    WScript.Echo ""
    WScript.Echo "Support URL: " & vbCrLf & objEntry.SupportURL
    WScript.Echo ""
    WScript.Echo "Description:   " & vbCrLf & objEntry.Description
    WScript.Echo ""
    WScript.Echo "Installed On: " & vbCrLf & objEntry.Date
    WScript.Echo ""    
    Select Case objEntry.ResultCode
        Case 1 ResultCode = "Pending Reboot"
        Case 2 ResultCode = "Successfully Installed"
        Case 4 ResultCode = "Installation Failed"
        Case 5 ResultCode = "Installation Canceled"
        Case Else
        ResultCode = "Unknown Installation Status"
    End Select
    WScript.Echo "Result code: " & vbCrLf & ResultCode
    WScript.Echo ""
    WScript.Echo "Client application ID: " & vbCrLf & objEntry.ClientApplicationID
    i = 1
    For Each strStep in objEntry.UninstallationSteps
        WScript.Echo i & " -- " & strStep
        i = i + 1
    Next
    If objEntry.UninstallationNotes = "" Then
        ' No uninstallation notes, print nothing
    Else
        WScript.Echo ""
        WScript.Echo "Uninstallation notes: " & vbCrLf & objEntry.UninstallationNotes
    End If
    WScript.Echo "=============================="
    WScript.Echo ""
    WScript.Echo ""
Next


Sub RunMeWithCScript()
    Dim ScriptEngine, engineFolder, Args, arg, scriptName, argString, scriptCommand
    
    ScriptEngine = UCase(Mid(WScript.FullName, InstrRev(WScript.FullName, "\") + 1))
    engineFolder = Left(WScript.FullName, InstrRev(WScript.FullName, "\"))
    argString = ""
    
    If ScriptEngine = "WSCRIPT.EXE" Then
        Dim Shell
        Set Shell = CreateObject("WScript.Shell")
        Set Args = WScript.Arguments
        
        For Each arg in Args 'loop though argument array as a collection to rebuild argument string
            If InStr(arg, " ") > 0 Then arg = """" & arg & """" 'If the argument contains a space wrap it in double quotes
            argString = argString & " " & Arg
        Next
        
        'Create a persistent command prompt for the cscript output window and call the script with its original arguments
        scriptCommand = "cmd.exe /k " & engineFolder & "cscript.exe """ & WScript.ScriptFullName & """" & argString
        
        Shell.Run scriptCommand, , False
        WScript.Quit
    Else
        Exit Sub 'Already Running with Cscript Exit this Subroutine
    End If
End Sub

MCTS Windows Internals, MCITP Server 2008 EA, MCTS MDT/BDD, MCSE/MCSA Server 2003, Server 2012, Windows 8
--------------------
Please read the rules before posting!
Please consider donating to MSFN to keep it up and running!

#3
msoff20xx

msoff20xx

    Newbie

  • Member
  • 15 posts
  • OS:none specified
  • Country: Country Flag
Hmm, when I try to run your script (see above) then I get an error popup:

line 8
Char 1
The service cannot be started, either because it is disabled or because it has noenabled device associated with it
Code 80070422

I don't know which service or deviuce is meant.
How can I run this script otherwise or enable (which?) service?

Peter

#4
jbm

jbm

    Senior Member

  • Member
  • PipPipPipPip
  • 640 posts
  • OS:Windows 7 x64
  • Country: Country Flag
The script run without errors for me.
But I have to click ok for each line that is echoed.
how can I get it to print to a file?

#5
cluberti

cluberti

    Gustatus similis pullus

  • Supervisor
  • 11,247 posts
  • OS:Windows 8.1 x64
  • Country: Country Flag

Hmm, when I try to run your script (see above) then I get an error popup:

line 8
Char 1
The service cannot be started, either because it is disabled or because it has noenabled device associated with it
Code 80070422

I don't know which service or deviuce is meant.
How can I run this script otherwise or enable (which?) service?

Peter

It's connecting to the Windows Update Service COM object. If you've disabled Windows Update or any of it's dependencies, this is the error you'll get. You can't enumerate updates that are tracked by the service if you've disabled it.


The script run without errors for me.
But I have to click ok for each line that is echoed.
how can I get it to print to a file?

Edit: Script updated to spawn itself via cscript in a cmd prompt, even if double-clicked.
MCTS Windows Internals, MCITP Server 2008 EA, MCTS MDT/BDD, MCSE/MCSA Server 2003, Server 2012, Windows 8
--------------------
Please read the rules before posting!
Please consider donating to MSFN to keep it up and running!

#6
maxvre

maxvre
  • Member
  • 7 posts
You could also:

go into control panel
Select small icons view
Select "Windows update" at the bottom
Then bottom left - see also - Installed updates

This will list all installed updates on the system.

#7
Glenn9999

Glenn9999

    Senior Member

  • Member
  • PipPipPipPip
  • 660 posts
  • OS:Windows 8 x64
  • Country: Country Flag
Sometimes, it helps to be able to have the data for analysis or for automation, though. The script (and other means) can be useful for that.

Edited by Glenn9999, 21 October 2010 - 04:59 PM.


#8
cluberti

cluberti

    Gustatus similis pullus

  • Supervisor
  • 11,247 posts
  • OS:Windows 8.1 x64
  • Country: Country Flag
Not to mention if the user's disabled the WU service, The Windows Update panel won't show you an update history either until you enable it - it uses the same COM object for the WU window. Clicking "view history" when the service is disabled will just give you a blank screen with an OK button. ;)
MCTS Windows Internals, MCITP Server 2008 EA, MCTS MDT/BDD, MCSE/MCSA Server 2003, Server 2012, Windows 8
--------------------
Please read the rules before posting!
Please consider donating to MSFN to keep it up and running!

#9
cluberti

cluberti

    Gustatus similis pullus

  • Supervisor
  • 11,247 posts
  • OS:Windows 8.1 x64
  • Country: Country Flag
Decided to write one to also show updates that are applicable to a Win7 system but are not installed as well, because I ended up needing something like this last night:

'// Run with cscript:
RunMeWithCScript()


'// Connect to the Windows Update COM object:
Set objSession = CreateObject("Microsoft.Update.Session")
Set objSearcher = objSession.CreateUpdateSearcher
Set colSearchResult = objSearcher.Search("IsInstalled=0")

'// Loop through and print to screen updates that are not drivers or language packs:
For I = 0 To colSearchResult.Updates.Count-1
    isLanguagePack = False
    Set update = colSearchResult.Updates.Item(I)
    For Each Category In update.Categories
        categoryID = Category.CategoryID
    Next
    If categoryID = "6d76a2a5-81fe-4829-b268-6eb307e40ef3" Then
        'Language Pack, print nothing and move to next item
    ElseIf update.Type = 2 Then
        'Driver, print nothing and move to next item
    Else
        WScript.Echo "=============================="
        WScript.Echo update.Title
        WScript.Echo ""
        WScript.Echo "Support URL: " & vbCrLf & update.SupportURL
        WScript.Echo ""
        For Each KB In update.KBArticleIDs
            WScript.Echo "KB Article ID: " & vbCrLf & KB
        Next
        WScript.Echo ""
        WScript.Echo "Update Description:   " & vbCrLf & update.Description
        x = 1
        For Each strStep in update.UninstallationSteps
            WScript.Echo x & " -- " & strStep
            x = x + 1
        Next
        If update.UninstallationNotes = "" Then
            ' No uninstallation notes, print nothing
        Else
            WScript.Echo ""
            WScript.Echo "Uninstallation notes: " & vbCrLf & update.UninstallationNotes
        End If
        WScript.Echo "=============================="
        WScript.Echo ""
        WScript.Echo ""
    End If
Next


Sub RunMeWithCScript()
    Dim ScriptEngine, engineFolder, Args, arg, scriptName, argString, scriptCommand
    
    ScriptEngine = UCase(Mid(WScript.FullName, InstrRev(WScript.FullName, "\") + 1))
    engineFolder = Left(WScript.FullName, InstrRev(WScript.FullName, "\"))
    argString = ""
    
    If ScriptEngine = "WSCRIPT.EXE" Then
        Dim Shell
        Set Shell = CreateObject("WScript.Shell")
        Set Args = WScript.Arguments
        
        For Each arg in Args 'loop though argument array as a collection to rebuild argument string
            If InStr(arg, " ") > 0 Then arg = """" & arg & """" 'If the argument contains a space wrap it in double quotes
            argString = argString & " " & Arg
        Next
        
        'Create a persistent command prompt for the cscript output window and call the script with its original arguments
        scriptCommand = "cmd.exe /k " & engineFolder & "cscript.exe """ & WScript.ScriptFullName & """" & argString
        
        Shell.Run scriptCommand, , False
        WScript.Quit
    Else
        Exit Sub 'Already Running with Cscript Exit this Subroutine
    End If
End Sub

MCTS Windows Internals, MCITP Server 2008 EA, MCTS MDT/BDD, MCSE/MCSA Server 2003, Server 2012, Windows 8
--------------------
Please read the rules before posting!
Please consider donating to MSFN to keep it up and running!

#10
rahulwithu

rahulwithu
  • Member
  • 1 posts
  • OS:Windows 7 x64
  • Country: Country Flag
Hi

Thanks for the ultimate tool to check un/installed updates.

Can we export the outcome of the script to a excel worksheet?

RK

#11
PinkFreud

PinkFreud

    Junior

  • Member
  • Pip
  • 75 posts
  • OS:Windows 7 x64
  • Country: Country Flag
@cluberti:

Thank you for these easy & very useful VBScripts. The "not installed" script worked perfectly & showed the 9 updates I have chosen to hide.
The "installed" script only showed 11 results (attached), however in WU cpl I have the following:

4 "Hotfix"
42 "Security"
19 "Update"
IE 9
--------------
66 total

Win 7 Home Prem SP1 x64 on a Gateway NV59C Notebook, recently (about a week ago) clean installed to rid myself of the OEM bloat...if that makes any difference.


Edited by PinkFreud, 26 May 2012 - 10:43 PM.


#12
cluberti

cluberti

    Gustatus similis pullus

  • Supervisor
  • 11,247 posts
  • OS:Windows 8.1 x64
  • Country: Country Flag
This is querying the same APIs that the inbox Windows Update uses, so assuming it's not showing everything that you've installed, the only thing that would make sense would be that you installed the patches manually (outside of WU). Otherwise, I'm not sure why this would be so. If you go to Windows Update and click the "view update history" link, does the output from my script match the output there? It should....
MCTS Windows Internals, MCITP Server 2008 EA, MCTS MDT/BDD, MCSE/MCSA Server 2003, Server 2012, Windows 8
--------------------
Please read the rules before posting!
Please consider donating to MSFN to keep it up and running!

#13
stenio

stenio
  • Member
  • 1 posts
  • OS:none specified
  • Country: Country Flag
Run this command from CMD:

WMIC WFE LIST FULL

You can export to HTML / CSV / TXT

Not need install anything.

#14
PinkFreud

PinkFreud

    Junior

  • Member
  • Pip
  • 75 posts
  • OS:Windows 7 x64
  • Country: Country Flag

This is querying the same APIs that the inbox Windows Update uses...the only thing that would make sense would be that you installed the patches manually (outside of WU)...If you go to Windows Update and click the "view update history" link, does the output from my script match the output there? It should....


Thank you for your follow-up, it is much appreciated. In reply to the above:

1) All updates installed via WU except the 4 hotfixes mentioned-- all 4 show under Control Panel\All Control Panel Items\Windows Update--Installed Updates tab, 2 show under \View update history

2) It does not. (PNG's attached) Including Hotfixes, IE9, MSSE , MSRT there are 72 items listed under "History"--vs 66 under "Installed"
Just for the halibut, I re-ran the VBScript--same result. :(

:unsure: :blink:



#15
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,418 posts
  • OS:none specified
  • Country: Country Flag
I wrote this VBS script that makes a HTA that list the missing and installed updates.

I Gunsmokingman give all users full permission to do what ever they want with this script.
Save As KB_Report.vbs
'-> This code is property of Gunsmokingman and Or Jake1Eye and you must have his permission to use.
'-> This is only posted as example code and meant only to used as such.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'/-> Varibles And Objects For The Script
Dim Act, CName, CN, Fso, UpdateSession, UpdateSearcher
Set Act = CreateObject("Wscript.Shell")
Set Fso = CreateObject("Scripting.FileSystemObject")
Set updateSession = CreateObject("Microsoft.Update.Session")
Set updateSearcher = updateSession.CreateupdateSearcher()
CName = Act.ExpandEnvironmentStrings("%ComputerName%")
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'/-> Ask If You Want To Use Script
Dim A1
A1 = Act.Popup( _
" Would You Like To Run The Report Updates Script?" & vbCrLf &_
"The Script Will Take Approx 5 Minutes To Be Done." & vbCrLf &_
"If Nothing Is Selected This Will Self Close In 7" & vbCrLf &_
"Seconds And Do Nothing", 7, "Search Updates",4132)
If A1 = 7 Or A1 = -1 Then
WScript.Quit(1)
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'/-> Varibles For The Script
Dim Arg1, Arg2, Arg3, C1, DT, Hta1, Hta2, Hta3, Hta4
Dim Rpt, Str1, Str2, Str3, SearchResult, TS, Update, Var1, Var2, Var3
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'/-> Replace Any Spaces In The Computer Name
If InStr(CName," ") Then
CN = Replace(CName," ", "_")
Else
CN = CName
End If
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'/-> Build The Hta
DT = Act.SpecialFolders("Desktop")
Rpt = (DT & "\" & CN & "_KbReport.hta")
Rpt = Act.ExpandEnvironmentStrings("%UserProfile%\desktop\" & CN & "_KbReport.hta")
Var1 = Chr(160) & Chr(171) & Chr(160)
Var2 = Chr(160) & Chr(187) & Chr(160)
Var3 = Var1 & "---------------------------------------" & Var2
Set SearchResult = UpdateSearcher.Search("IsInstalled=0 and Type='Software'")
Set TS = Fso.CreateTextFile(Rpt)
TS.WriteLine "<TITLE>" & CName & "</TITLE>" & vbCrLf &_
"<STYLE Type=""text/css"">" & vbCrLf &_
" Body{Font-Size:9.25pt;Font-Weight:Bold;" & vbCrLf &_
" Font-Family:segoeui,helvetica,verdana,arial,Poor Richard;" & vbCrLf &_
" Color:#000063;BackGround-Color:Transparent;" & vbCrLf &_
" Filter:progid:DXImageTransform.Microsoft.Gradient" & vbCrLf &_
" (StartColorStr='#fdf7f1',endColorStr='#d1cbc5');" & vbCrLf &_
" Margin-Top:5;Margin-Bottom:5;Margin-Left:4;Margin-Right:4;" & vbCrLf &_
" Padding-Top:5;Padding-Bottom:5;Padding-Left:4;Padding-Right:4;" & vbCrLf &_
" Text-Align:Left;Vertical-Align:Top;" & vbCrLf &_
" Border-Top:2px Solid #cbc7c3;Border-Bottom:3px Solid #a6a29e;" & vbCrLf &_
" Border-Left:2px Solid #bcb8b4;Border-Right:3px Solid #b2aeaa;}" & vbCrLf &_
" Table.Table1{Font-Size:8.25pt;Color:Blue;Font-Weight:Bold;Width:395px;}" & vbCrLf &_
" Div.D1{Font-Size:8.25pt;Color:#1e1e1e;Padding-Left:25;Width:97%;}" & vbCrLf &_
" Font.F1{Color:#004400;Padding-Left:18;}" & vbCrLf &_
" Font.F2{Font-Weight:Bold;Color:#000063;Padding-Left:23;}" & vbCrLf &_
"</STYLE>" & vbCrLf &_
"<script LANGUAGE='JScript'>window.resizeTo (675,395), window.moveTo (210,175);</SCRIPT>"
TS.WriteLine "<BODY><CENTER><TABLE>" & Var1 & Now() & Var2 &_
"</TABLE><TABLE>List Of Missing Updates</TABLE><HR Width=95%></CENTER>"
For I = 0 To searchResult.Updates.Count-1
C1 = C1 + 1
If Len(C1) = 3 Then C1 = C1
If Len(C1) = 2 Then C1 = "0" & C1
If Len(C1) = 1 Then C1 = "00" & C1
Set Update = SearchResult.Updates.Item(I)
RptUpdate()
Arg3 = Arg3 & vbCrLf & Update.Title
Next
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'/-> If There Are No Updates To Install On The Machine
If SearchResult.Updates.Count = 0 Then
TS.WriteLine "<FONT Class='F1;'>" & Var1 & C1 & Var2 & "</FONT>" & vbCrLf &_
"<FONT Class='F2'>There Are No Applicable Updates, To Install""</FONT>" & vbCrLf &_
"<CENTER><HR Width=95%></CENTER>"
End If
Dim SResults
C1 = 0
TS.WriteLine "<CENTER><TABLE>List Of Installed Updates</TABLE><HR Width=95%></CENTER>"
Set SResults = UpdateSearcher.Search("IsInstalled=1 and Type='Software'")
For I = 0 To SResults.Updates.Count-1
C1 = C1 + 1
If Len(C1) = 3 Then C1 = C1
If Len(C1) = 2 Then C1 = "0" & C1
If Len(C1) = 1 Then C1 = "00" & C1
Set Update = SResults.Updates.Item(I)
RptUpdate()
Next
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'/-> Report The Update Information
Function RptUpdate()
TS.WriteLine "<FONT Class='F1;'>" & Var1 & C1 & Var2 & "</FONT>" & vbCrLf &_
"<FONT Class='F2'>" & Update.Title & "</FONT>" & vbCrLf &_
"<DIV Class='D1'>  " & Update.Description & "</DIV>" & vbCrLf &_
"<CENTER><HR Width=95%></CENTER>"
End Function
TS.Close
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'/-> Run The Hta
Set Arg1 = Fso.GetFile(Rpt)
Act.Run("mshta.exe " & Chr(34) & Arg1.Path & Chr(34)),1,True
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'/-> Keep Or Delete The Hta Report
If MsgBox("Did You Want To Keep The HTA Update Report?" & vbCrLf & _
"Yes To Keep The Hta, No To Delete The Hta.",4132,"Keep Or Delete") = 7 Then
Fso.DeleteFile Arg1
End If



GunSmokingMan



#16
MagicAndre1981

MagicAndre1981

    after Windows 7 GA still Vista lover :)

  • Patrons
  • 5,917 posts
  • OS:Vista Ultimate x86
  • Country: Country Flag

Donator

nice script!

Can you add the option to click the entries and to to the KB page?
Posted Image

#17
submix8c

submix8c

    Inconceivable!

  • Patrons
  • 4,155 posts
  • OS:none specified
  • Country: Country Flag
:w00t:
Script is not Windows 7 Specific... :)

Someday the tyrants will be unthroned... Jason "Jay" Chasteen; RIP, bro!

Posted Image


#18
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,418 posts
  • OS:none specified
  • Country: Country Flag

Can you add the option to click the entries and to to the KB page?


I have updated the script so it goes to the search results of the KB, this does not
wotk 100%. I have edit the script so it will try and get the Kb number then pass
that varible to microsoft.com/downloads/results and hope it list the information.



I Gunsmokingman give all users full permission to do what ever they want with this script.
Save As List_Kb.vbs
'-> This code is property of Gunsmokingman and Or Jake1Eye and you must have his permission to use.
'-> This is only posted as example code and meant only to used as such.
Option Explicit
'-> Makes Shorter
Dim Vb :Vb = vbCrLf
'-> Objects For Script Run Time
Dim Act, Fso, CName
Set Act = CreateObject("Wscript.Shell")
Set Fso = CreateObject("Scripting.FileSystemObject")
CName = Act.ExpandEnvironmentStrings("%ComputerName%")
'-> Ask If You Want To Use Script
Dim A1
A1 = Act.Popup( _
" Would You Like To Run The Report Updates Script?" & Vb & _
"The Script Will Take Approx 5 Minutes To Be Done." & Vb & _
"If Nothing Is Selected This Will Self Close In 7" & Vb & _
"Seconds And Do Nothing", 7, "Search Updates",4132)
If A1 = 7 Or A1 = -1 Then
WScript.Quit(1)
End If
'-> Varibles For Hta Output
Dim Hta :Hta = Act.SpecialFolders("Desktop") & "\" & CName & "_KbInfo.hta"
Dim Ar :Ar = Chr(160) & Chr(187) & Chr(160)
Dim Al :Al = Chr(160) & Chr(171) & Chr(160)
Dim Ts
'-> Search Objects And Varibles
Dim SearchResult, Update, UpDateSearcher,UpDateSession
Set UpDateSession = CreateObject("Microsoft.Update.Session")
Set UpDateSearcher = UpDateSession.CreateUpDateSearcher()
Set SearchResult = UpDateSearcher.Search("Type='Software'")
'-> Varibles For Count, Loop, Updates
Dim C1, I, Kb_C, Kb_M, M1, V1, V2 :C1=0 :M1=0
'-> Loop To List Install And Missing Updates
For I = 0 To SearchResult.Updates.Count-1
Set Update = SearchResult.Updates.Item(I)
If Update.IsInstalled Then
C1 = C1 + 1 : V1 = C1
Kb_C = Kb_C & C1 & "=-=" & Update.Title & "=-=" & Update.Description & Vb
Else
M1 = M1 + 1 : V2 = M1
Kb_M = Kb_M & M1 & "=-=" & Update.Title & "=-=" & Update.Description & Vb
End If
Next
'-> If There Are No Missing Updates
If M1 = 0 Then
V2 = "000"
Kb_M = "000=-=No Updates Found=-=There Was No Updates Missing" & Vb
End If
'-> If There Are No Installed Updates
If C1 = 0 Then
V1 = "000"
Kb_C = "000=-=No Updates Found Installed=-=There Was No Updates Found Installed." & Vb
End If
'-> Add Zero For 3 Digit
If Len(V1) = 2 Then V1 = "0" & V1
If Len(V1) = 1 Then V1 = "00" & V1
If Len(V2) = 2 Then V2 = "0" & V2
If Len(V2) = 1 Then V2 = "00" & V2
'-> Build The Hta Report
Set TS = Fso.CreateTextFile(Hta)
TS.WriteLine "<TITLE>" & CName & "</TITLE>" & Vb & _
"<STYLE Type=""text/css"">" & Vb & _
" Body{Font-Size:9.25pt;Font-Weight:Bold;" & Vb & _
" Font-Family:segoeui,helvetica,verdana,arial,Poor Richard;" & Vb & _
" Color:#000063;BackGround-Color:Transparent;" & Vb & _
" Filter:progid:DXImageTransform.Microsoft.Gradient" & Vb & _
" (StartColorStr='#fdf7f1',endColorStr='#d1cbc5');" & Vb & _
" Margin-Top:5;Margin-Bottom:5;Margin-Left:4;Margin-Right:4;" & Vb & _
" Padding-Top:5;Padding-Bottom:5;Padding-Left:4;Padding-Right:4;" & Vb & _
" Text-Align:Left;Vertical-Align:Top;" & Vb & _
" Border-Top:2px Solid #cbc7c3;Border-Bottom:3px Solid #a6a29e;" & Vb & _
" Border-Left:2px Solid #bcb8b4;Border-Right:3px Solid #b2aeaa;}" & Vb & _
" TD.Tx1{Font-Size:8.25pt;Color:#004747;Font-Weight:Bold;Padding-Left:3;Width:70pt;}" & Vb & _
" TD.Tx2{Font-Size:8.25pt;Color:#006969;Font-Weight:Bold;Width:105pt;}" & Vb & _
" P.D1{Font-Size:8.25pt;Color:#1e1e1e;Width:99%;Padding-Left:1;Margin:1pt;}" & Vb & _
" FONT.F1{Font-Size:8.25pt;Color:#004400;Padding-Left:3;Width:17pt;}" & Vb & _
" FONT.F2{Font-Size:8.25pt;Font-Weight:Bold;Color:#000063;Padding-Left:3;}" & Vb & _
"</STYLE>" & Vb & _
"<script LANGUAGE='JScript'>window.resizeTo (725,425), window.moveTo (210,175);</SCRIPT>"
Ts.WriteLine "<BODY Link='#003535' vLink='#007575' aLink='#003535'>" & Vb & _
"<TABLE ALIGN='CENTER'><TD CLASS='Tx1'>Scan Date Time</TD><TD CLASS='Tx2'>" & _
Ar & Now & "</TD></TABLE>" & Vb & _
"<TABLE ALIGN='CENTER'><TD CLASS='Tx1'>Computer Name</TD><TD CLASS='Tx2'>" & _
Ar & CName & "</TD></TABLE>" & Vb & _
"<TABLE ALIGN='CENTER'><TD CLASS='Tx1'>Install KB</TD><TD CLASS='Tx2'>" & _
Ar & V1 & "</TD></TABLE>" & Vb & _
"<TABLE ALIGN='CENTER'><TD CLASS='Tx1'>Missing KB</TD><TD CLASS='Tx2'>" & _
Ar & V2 & "</TD></TABLE><HR Width=97%>"
Ts.WriteLine "<TABLE Align='Center'>List Of Missing Updates</TABLE><HR Width=99%>"
SortInfo(Kb_M)
Ts.WriteLine "<TABLE Align='Center'>List Of Installed Updates</TABLE><HR Width=99%>"
SortInfo(Kb_C)
Ts.Close
'-> Run The Hta
Act.Run("mshta.exe " & Chr(34) & Hta & Chr(34)),1,True
'/-> Keep Or Delete The Hta Report
If MsgBox("Did You Want To Keep The HTA Update Report?" & Vb & _
"Yes To Keep The Hta, No To Delete The Hta.",4132,"Keep Or Delete") = 7 Then
Fso.DeleteFile Hta, True
End If
'-> Function Sort The Info For Display In The Hta
Function SortInfo(Arg)
Dim Obj, S1, V
For Each Obj In Split(Arg,Vb)
If Not Obj = "" Then
V = Split(Obj,"=-=")
S1= Right(V(1),11)
If Len(V(0)) = 2 Then V(0) = "0" & V(0)
If Len(V(0)) = 1 Then V(0) = "00" & V(0)
If InStr(S1,"(") Then S1 = Replace(S1,"(","")
If InStr(S1,")") Then S1 = Replace(S1,")","")
If InStr(S1,"-") Then S1 = Replace(S1,"-","")
If InStr(S1," ") Then S1 = Replace(S1," ","")
'-> Sort The Info For Links And None links
If LCase(Left(S1,2)) = "kb" Then
Ts.WriteLine "<FONT Class='F1'>" & Al & V(0) & Ar & "</FONT>" & Vb & _
"<FONT Class='F2'>" & V(1) & "</FONT>" & Vb &_
"<P Class='D1'>  " & V(2) & "</DIV>" & Vb & _
"<DIV ALIGN='CENTER'>" & Vb & _
"<A HREF='http://www.microsoft.com/downloads/results.aspx?pocId=&freetext=" & _
S1 &"&DisplayLang='>" & S1 & " Information</A></DIV><HR Width=99%>" & Vb & Vb
Else
Ts.WriteLine "<FONT Class='F1'>" & Al & V(0) & Ar & "</FONT>" & Vb &_
"<FONT Class='F2'>" & V(1) & "</FONT>" & Vb &_
"<P Class='D1'>  " & V(2) & "</DIV><HR Width=99%>" & Vb & Vb
End If
End If
Next
End Function



GunSmokingMan



#19
PinkFreud

PinkFreud

    Junior

  • Member
  • Pip
  • 75 posts
  • OS:Windows 7 x64
  • Country: Country Flag
Nice script. :thumbup

Good news/ Bad news...

The Good: Results seem accurate at first glance :)

The Bad (IMHO, YMMV): Opens Bing results in Innernetz Ex-PLODE-r :angry:

Edited by PinkFreud, 29 May 2012 - 06:12 PM.


#20
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,418 posts
  • OS:none specified
  • Country: Country Flag
This is what I get when I selected a radom link from my computer, with IE as my browser on win7 x64

Attached Files




GunSmokingMan



#21
PinkFreud

PinkFreud

    Junior

  • Member
  • Pip
  • 75 posts
  • OS:Windows 7 x64
  • Country: Country Flag

This is what I get when I selected a radom link from my computer, with IE as my browser on win7 x64


>>>blushes<<< I stand corrected, I haven't used IE for years and have NEVER used IE 9 for ANY browsing (used IE 10 a little in 8 Cons Prev) Ididn't recognize the advanced results from MSDLC

Here's what I'm used to in FF & Chrome (KB specific):

Edited by PinkFreud, 29 May 2012 - 07:27 PM.


#22
gunsmokingman

gunsmokingman

    MSFN Master

  • Super Moderator
  • 2,418 posts
  • OS:none specified
  • Country: Country Flag
I made this HTA that does the same as the VBS script.


I Gunsmokingman give all users full permission to do what ever they want with this script.
Save As Kb_List.hta
Attached File  Kb_List_Hta.png   50.04KB   22 downloads
<!--
 Hta And Script By Gunsmokingman Aka Jake1Eye
 This code is property of Gunsmokingman and Or Jake1Eye and you must have his permission to use.
 This is only posted as example code and meant only to used as such.
-->
<TITLE>List Install Updates</TITLE>
<HTA:APPLICATION ID="KbInfo"
SCROLL="No"
SCROLLFLAT ="No"
SingleInstance="Yes"
ShowInTaskbar="Yes"
SysMenu="No"
MaximizeButton="No"
MinimizeButton="No"
Border="Thin"
BORDERSTYLE ="complex"
INNERBORDER ="No"
Caption="Yes"
WindowState="Normal"
APPLICATIONNAME="InfoKb"
Icon="%SystemRoot%\explorer.exe">
<STYLE Type='text/css'>
Body
{
Font-Size:9.25pt;
Font-Weight:Bold;
Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS;
Color:Black;
BackGround-Color:#EFE9E3;
Margin-Top:21;
Margin-Bottom:1;
Margin-Left:4;
Margin-Right:4;
Padding-Top:1;
Padding-Bottom:1;
Padding-Left:4;
Padding-Right:4;
Text-Align:Left;
Vertical-Align:Top;
Border-Top:0px Transparent;
Border-Bottom:0px Transparent;
Border-Left:0px Transparent;
Border-Right:0px Transparent;
}
DIV
{
Font-Size:8.25pt;
Font-Weight:Bold;
Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS
Color:Black;#635D57;
Text-Align:Left;
Filter:progid:DXImageTransform.Microsoft.Gradient
(StartColorStr='#ece6e0',EndColorStr='#c0bab4');
Padding:3pt;
}
TD
{
Font-Size:8.25pt;
Font-Weight:Bold;
Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS
Color:Black;#635D57;
Text-Align:Center;
Filter:progid:DXImageTransform.Microsoft.Gradient
(StartColorStr='#ece6e0',EndColorStr='#c0bab4');
}
TD.A1
{
Cursor:Hand;
Color:#224747;
Text-Align:Center;
Filter:progid:DXImageTransform.Microsoft.Gradient
(StartColorStr='AliceBlue',endColorStr='LightSlateGray');
}
TD.A2
{
Cursor:Hand;
Color:#113535;
Text-Align:Center;
Filter:progid:DXImageTransform.Microsoft.Gradient
(StartColorStr='AliceBlue',endColorStr='SeaGreen');
}
Select
{
Font-Size:7.25pt;
Font-Weight:Bold;
Font-Family:Segoe Ui, Arial,Tahoma,Comic Sans MS
}
</STYLE>
<script LANGUAGE='JScript'>
//-> Resize And Place In Approx center
var W = 725, H = 275;
window.resizeTo(W,H)
window.moveTo(screen.availWidth/2-(W/2),screen.availHeight/2-(H/2))
</SCRIPT>
<script Language="VBScript">
Dim Kb_Info_Var, Kb_Name_Var, Kb_Select
Dim Ar :Ar = Chr(160) & Chr(187) & Chr(160)
Function FindKb()
If Kb_C.options.length = 0 Then QuerryKb(1)
If Kb_M.options.length = 0 Then QuerryKb(0)
Exit Function
End Function
'-> Add To The Select option Update Name And Info
Function QuerryKb(N)
Dim objOption
Dim C1 :C1 = 0
Set updateSession = CreateObject("Microsoft.Update.Session")
Set updateSearcher = updateSession.CreateupdateSearcher()
Set SearchResult = UpdateSearcher.Search("IsInstalled=" & N & " and Type='Software'")
For I = 0 To searchResult.Updates.Count-1
C1 = C1 + 1
Set Update = SearchResult.Updates.Item(I)
Set objOption = Document.createElement("OPTION")
If C1 Mod 2 Then
objOption.Text = Update.Title
objOption.Value = Update.Description
objOption.style.color = "Blue"
objOption.style.background= "#ECE6E1"
Else
objOption.Text = Update.Title
objOption.Value = Update.Description
objOption.style.color = "Green"
objOption.style.background= "#FBF5F0"
End If
If N = 1 Then Kb_C.Add(objOption)
If N = 0 Then Kb_M.Add(objOption)
Next
If N = 1 And SearchResult.Updates.Count = 0 Then
Set objOption = Document.createElement("OPTION")
objOption.Text = "No Update Found Installed"
objOption.Value = "No Update Information. Please Run Windows Update"
objOption.style.color = "Blue"
objOption.style.background= "#ECE6E1"
Kb_C.Add(objOption)
End If
If N = 0 And SearchResult.Updates.Count = 0 Then
Set objOption = Document.createElement("OPTION")
objOption.Text = "No Update Are Needed"
objOption.Value = "No Update Missing. All Windows Updates Installed"
objOption.style.color = "Blue"
objOption.style.background= "#ECE6E1"
Kb_C.Add(objOption)
End If
If Len(C1) = 2 Then C1 = "0" & C1
If Len(C1) = 1 Then C1 = "00" & C1
If N = 1 Then Tx1.innerHTML = "Install Updates :" & Ar & C1
If N = 0 Then Tx2.innerHTML = "Missing Updates :" & Ar & C1
Exit Function
End Function
'-> Confirm Update Select Option
Function SelectConfirm()
If Kb_C.options.length => 1 Then
On Error Resume Next
For i = 0 To Kb_C.options.length
If Kb_C.options(i).selected Then
Kb_Select = 1
Kb_Info_Var = Kb_C.options(i).value
Kb_Name_Var = Kb_C.options(i).text
Kb_Name.style.visibility = ""
Kb_Name.innerHTML = Kb_Name_Var
Kb_Info.style.visibility = ""
Kb_Info.innerHTML = Kb_Info_Var
End If
Next
End If
Exit Function
End Function
'-> Missing Update Select Option
Function SelectMissing()
If Kb_M.options.length => 1 Then
On Error Resume Next
For i = 0 To Kb_M.options.length
If Kb_M.options(i).selected Then
Kb_Select = 2
Kb_Info_Var = Kb_M.options(i).value
Kb_Name_Var = Kb_M.options(i).text
Kb_Name.style.visibility = ""
Kb_Name.innerHTML = Kb_Name_Var
Kb_Info.style.visibility = ""
Kb_Info.innerHTML = Kb_Info_Var
End If
Next
End If
Exit Function
End Function
'-> Process Select Item To Open New Window
Function ProcessSearchQuerry()
If Kb_C.options.length = 0 Or Kb_M.options.length = 0 Then
alert("Please Run The Process KB Querry Button First. Then" & vbCrlf & _
"Select An Update From The List That You, Want" & vbCrlf & _
"To Find Some More Information Or Download." )
ElseIf Kb_Name_Var = "" Then
alert("Please Select An Item From The Select Options" )
Else
If Kb_Select = 1 Then S1 = Right(Kb_Name_Var,11)
If Kb_Select = 2 Then S1 = Right(Kb_Name_Var,11)
If InStr(S1,"(") Then S1 = Replace(S1,"(","")
If InStr(S1,")") Then S1 = Replace(S1,")","")
If InStr(S1,"-") Then S1 = Replace(S1,"-","")
If InStr(S1," ") Then S1 = Replace(S1," ","")
If LCase(Left(S1,2)) = "kb" Then
window.open( _
"http://www.microsoft.com/downloads/results.aspx?pocId=&freetext=" & _
S1 &"&DisplayLang=")
Else
alert("Can Not Process This Update Link")
End If
End If
Exit Function
End Function
</SCRIPT>
<BODY Style='Align:Center;'>
<TABLE Align='Center' Border='1'>
<TD ID='Tx1' Class='A1' style="width:223pt;">Install Updates</TD>
<TD ID='Tx2' Class='A1' style="width:223pt;">Missing Updates</TD>
</TABLE>
<TABLE Align='Center' Border='1'>
<TD><Select size="1" ID='Kb_C' name='Kb_C' OnChange="SelectConfirm()" style="width:225pt;">
</Select></TD>
<TD><Select size="1" ID='Kb_M' name='Kb_M' OnChange="SelectMissing()" style="width:225pt;">
</Select></TD>
</TABLE>
<!-- Display KB Name -->
<DIV ID='Kb_Name' Style='position:absolute;Bottom:85pt;Left:42pt;
Width:446pt;Height:16pt;visibility:hidden;'></DIV>
<!-- Display KB Information -->
<DIV ID='Kb_Info' Style='position:absolute;Bottom:36pt;Left:42pt;
Width:446pt;Height:48pt;visibility:hidden;'></DIV>
<!-- Button Container -->
<TABLE Border='1' Style='position:absolute;Bottom:16pt;Left:73pt;'>
<TD Class='A1' OnMouseOver="this.className='A2'"
OnMouseOut="this.className='A1'" OnClick='FindKb()'
style="width:123pt;Height:19;">Process KB Querry</TD>
<TD Class='A1' OnMouseOver="this.className='A2'"
OnMouseOut="this.className='A1'" OnClick='ProcessSearchQuerry()'
style="width:123pt;Height:19;">Open Application</TD>
<TD Class='A1' OnMouseOver="this.className='A2'"
OnMouseOut="this.className='A1'" OnClick='window.close()'
style="width:123pt;Height:19;">Close Application</TD>
</TABLE>
</BODY>



GunSmokingMan



#23
MagicAndre1981

MagicAndre1981

    after Windows 7 GA still Vista lover :)

  • Patrons
  • 5,917 posts
  • OS:Vista Ultimate x86
  • Country: Country Flag

Donator

the script works fine. Well done! good job :thumbup
Posted Image

#24
tommyp

tommyp

    MSFN Addict

  • Developer
  • 1,680 posts
  • OS:none specified
  • Country: Country Flag
I hate to hijack, but the posts in this thread is something I'm trying to figure out. I haven't the foggiest about VBS scripts. Can someone code me a vbs that creates a semicolon delimited txt file that lists installed and not installed KB#'s and the ProductID#'s (the one that looks like a GUID). Wish list... if there is a way to get superseded updates, maybe add another semicolon with the word superseded on the same line? Wish list part 2.... it would be cool if there's also a semicolon delimited direct download link to the msu file too.

Here's an example of the desired output.
2667402;bfe5b177-a086-47a0-b102-097e4fa1f807

TIA!
Posted Image




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users



How to remove advertisement from MSFN