Jump to content

How to list all currently installed Win7 patches/updates?


msoff20xx

Recommended Posts


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 ShorterDim Vb :Vb = vbCrLf'-> Objects For Script Run TimeDim Act, Fso, CNameSet Act = CreateObject("Wscript.Shell")Set Fso = CreateObject("Scripting.FileSystemObject")CName = Act.ExpandEnvironmentStrings("%ComputerName%")'-> Ask If You Want To Use ScriptDim A1A1 = 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 ThenWScript.Quit(1)End If'-> Varibles For Hta OutputDim 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 VariblesDim SearchResult, Update, UpDateSearcher,UpDateSessionSet UpDateSession = CreateObject("Microsoft.Update.Session")Set UpDateSearcher = UpDateSession.CreateUpDateSearcher()Set SearchResult = UpDateSearcher.Search("Type='Software'")'-> Varibles For Count, Loop, UpdatesDim C1, I, Kb_C, Kb_M, M1, V1, V2 :C1=0 :M1=0'-> Loop To List Install And Missing UpdatesFor I = 0 To SearchResult.Updates.Count-1Set Update = SearchResult.Updates.Item(I)If Update.IsInstalled ThenC1 = C1 + 1 : V1 = C1Kb_C = Kb_C & C1 & "=-=" & Update.Title & "=-=" & Update.Description & VbElseM1 = M1 + 1 : V2 = M1Kb_M = Kb_M & M1 & "=-=" & Update.Title & "=-=" & Update.Description & VbEnd IfNext'-> If There Are No Missing UpdatesIf M1 = 0 ThenV2 = "000"Kb_M = "000=-=No Updates Found=-=There Was No Updates Missing" & VbEnd If'-> If There Are No Installed UpdatesIf C1 = 0 ThenV1 = "000"Kb_C = "000=-=No Updates Found Installed=-=There Was No Updates Found Installed." & VbEnd If'-> Add Zero For 3 DigitIf Len(V1) = 2 Then V1 = "0" & V1If Len(V1) = 1 Then V1 = "00" & V1If Len(V2) = 2 Then V2 = "0" & V2If Len(V2) = 1 Then V2 = "00" & V2'-> Build The Hta ReportSet 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 HtaAct.Run("mshta.exe " & Chr(34) & Hta & Chr(34)),1,True'/-> Keep Or Delete The Hta ReportIf 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 ThenFso.DeleteFile Hta, TrueEnd If'-> Function Sort The Info For Display In The HtaFunction SortInfo(Arg)Dim Obj, S1, VFor Each Obj In Split(Arg,Vb)If Not Obj = "" ThenV = 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 linksIf LCase(Left(S1,2)) = "kb" ThenTs.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 & VbElseTs.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 & VbEnd IfEnd IfNextEnd Function
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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

post-5386-0-25423200-1338360060_thumb.pn

<!-- 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 MSColor: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 MSColor: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 centervar 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_SelectDim 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 FunctionEnd Function'-> Add To The Select option Update Name And InfoFunction QuerryKb(N)Dim objOptionDim C1 :C1 = 0Set 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-1C1 = C1 + 1Set Update = SearchResult.Updates.Item(I)Set objOption = Document.createElement("OPTION")If C1 Mod 2 ThenobjOption.Text = Update.TitleobjOption.Value = Update.DescriptionobjOption.style.color = "Blue"objOption.style.background= "#ECE6E1"ElseobjOption.Text = Update.TitleobjOption.Value = Update.DescriptionobjOption.style.color = "Green"objOption.style.background= "#FBF5F0"End IfIf N = 1 Then Kb_C.Add(objOption)If N = 0 Then Kb_M.Add(objOption)NextIf N = 1 And SearchResult.Updates.Count = 0 ThenSet 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 IfIf N = 0 And SearchResult.Updates.Count = 0 ThenSet 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 IfIf Len(C1) = 2 Then C1 = "0" & C1If Len(C1) = 1 Then C1 = "00" & C1If N = 1 Then Tx1.innerHTML = "Install Updates :" & Ar & C1If N = 0 Then Tx2.innerHTML = "Missing Updates :" & Ar & C1Exit FunctionEnd Function'-> Confirm Update Select OptionFunction SelectConfirm()If Kb_C.options.length => 1 ThenOn Error Resume NextFor i = 0 To Kb_C.options.lengthIf Kb_C.options(i).selected ThenKb_Select = 1Kb_Info_Var = Kb_C.options(i).valueKb_Name_Var = Kb_C.options(i).textKb_Name.style.visibility = ""Kb_Name.innerHTML = Kb_Name_VarKb_Info.style.visibility = ""Kb_Info.innerHTML = Kb_Info_VarEnd IfNextEnd IfExit FunctionEnd Function'-> Missing Update Select OptionFunction SelectMissing()If Kb_M.options.length => 1 ThenOn Error Resume NextFor i = 0 To Kb_M.options.lengthIf Kb_M.options(i).selected ThenKb_Select = 2Kb_Info_Var = Kb_M.options(i).valueKb_Name_Var = Kb_M.options(i).textKb_Name.style.visibility = ""Kb_Name.innerHTML = Kb_Name_VarKb_Info.style.visibility = ""Kb_Info.innerHTML = Kb_Info_VarEnd IfNextEnd IfExit FunctionEnd Function'-> Process Select Item To Open New WindowFunction ProcessSearchQuerry()If Kb_C.options.length = 0 Or Kb_M.options.length = 0 Thenalert("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 = "" Thenalert("Please Select An Item From The Select Options" )ElseIf 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" Thenwindow.open( _"http://www.microsoft.com/downloads/results.aspx?pocId=&freetext=" & _S1 &"&DisplayLang=")Elsealert("Can Not Process This Update Link")End IfEnd IfExit FunctionEnd 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>
Link to comment
Share on other sites

  • 1 month later...

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!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...