Jump to content

Post XP_SP2 Hot fix integration for existing OS installations


Recommended Posts

I'd have to say the first window flashes up and then disappears and then nothing. all the vbsript processes have ended.

I figure out the problem

It was this line, it works fine on Vista, but on XP it would not work.

 & Arg2.Path &

So I change it to this on XP and it works

 Chr(34) & Arg2.Path & Chr(34)

New Code

Save As ReportUpdates_V1.vbs

Dim Act :Set Act = CreateObject("Wscript.Shell")
Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Arg1, Arg2,Ts
Arg1 = Act.ExpandEnvironmentStrings("%UserProfile%\Desktop\UpdateReport.vbs")
Set Ts = Fso.CreateTextFile(Arg1)
Ts.WriteLine _
"Dim ColUpdates, ObjResult, ObjSession, Searcher" & vbCrLf &_
"Dim C1, C2, Confirm, Missing, V1, V2, V3" & vbCrLf &_
" V1 = Chr(160) & Chr(171) & Chr(160)" & vbCrLf &_
" V2 = Chr(160) & Chr(187) & Chr(160)" & vbCrLf &_
" V3 = V1 & ""---------------------------------------"" & V2" & vbCrLf &_
" WScript.Echo V3 & vbcrlf & V1 & ""Processing Search For Installed Updates""" &_
" & V2 & vbcrlf & V3" & vbCrLf & " WScript.Echo" & vbCrLf &_
"Set ObjSession = CreateObject(""Microsoft.Update.Session"")" & vbCrLf &_
"Set Searcher = ObjSession.CreateUpdateSearcher" & vbCrLf &_
"Set ObjResult = Searcher.Search(""Type='Software'"")" & vbCrLf &_
"Set ColUpdates = ObjResult.Updates" & vbCrLf &_
"'/-> Loop To Collect The Names" & vbCrLf &_
" For i = 0 to ColUpdates.Count - 1" & vbCrLf &_
" If ColUpdates.Item(i).IsInstalled <> 0 Then" & vbCrLf &_
" C1 = C1 + 1" & vbCrLf &_
" If Len(C1) = 3 Then C1 = C1" & vbCrLf &_
" If Len(C1) = 2 Then C1 = ""0"" & C1" & vbCrLf &_
" If Len(C1) = 1 Then C1 = ""00"" & C1" & vbCrLf &_
" Confirm = Confirm & V2 & C1 & V2 & ColUpdates.Item(i).Title & vbCrLf" & vbCrLf &_
" Else" & vbCrLf &_
" C2 = C2 + 1" & vbCrLf &_
" If Len(C2) = 3 Then C2 = C2" & vbCrLf &_
" If Len(C2) = 2 Then C2 = ""0"" & C2" & vbCrLf &_
" If Len(C2) = 1 Then C2 = ""00"" & C2" & vbCrLf &_
" Missing = Missing & V2 & C2 & V2 & ColUpdates.Item(i).Title & vbCrLf" & vbCrLf &_
" End If" & vbCrLf &_
" Next" & vbCrLf &_
" Dim Col1, Col2, Str1, Str2" & vbCrLf &_
" WScript.Echo V3 & vbCrLf & V1 & "" Confirm Installed Update "" & V2 & vbCrLf & V3" & vbCrLf &_
" Col1 = Split(Confirm,vbCrLf)" & vbCrLf &_
" For Each Str1 In Col1 :WScript.Echo Str1 :WScript.Sleep 250 :Next" & vbCrLf &_
" WScript.Echo V3 & vbCrLf & V1 & "" Missing Installed Update "" & V2 & vbCrLf & V3" & vbCrLf &_
" Col2 = Split(Missing,vbCrLf)" & vbCrLf &_
" For Each Str2 In Col2 :WScript.Echo Str2 :WScript.Sleep 250 :Next" & vbCrLf &_
" WScript.Echo V3" & vbCrLf &_
" WScript.Echo V1 & ""Processing Completed Search For Updates"" & V2 & vbcrlf & V3"
Ts.Close()
Set Arg2 = Fso.GetFile(Arg1)
Act.Run("%Comspec% /c @Echo Off &&" & _
"Color 9E && Title Update Report %ComputerName% " &_
"&& cscript.exe " & Chr(34) & Arg2.Path & Chr(34) & "&& pause"),1,True
Arg2.Delete()

Edited by gunsmokingman
Link to comment
Share on other sites


yep that works. nice work.

Well at least on a real machine.

I get an error when I run it on VM:

C:\Documents and Settings\Administrator\Desktop\UpdateReport.vbs(10, 1) (null): 0x8024402C

But that might have something to do with the custom install I wazs testing on it. What all would this be relying on? Just the Update service?

Link to comment
Share on other sites

yep that works. nice work.

Well at least on a real machine.

I get an error when I run it on VM:

C:\Documents and Settings\Administrator\Desktop\UpdateReport.vbs(10, 1) (null): 0x8024402C

But that might have something to do with the custom install I wazs testing on it. What all would this be relying on? Just the Update service?

I believe it relies on this object as to what services it needs to run I do not know.

With this object you can download and install the updates I believe.

Set ObjSession = CreateObject("Microsoft.Update.Session")

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...