Jump to content

Integrate several hotfixes using batch.


BoardBabe

Recommended Posts

I have a folder with several KB* hotfix updates that I would like to /integrate to my i386 source. Doing this manually per file on about 40 updates will take a while. Can someone help me make a batch that /integrate one by one hotfix (from current dir to source dir e:\WinDVD\i386)?

Link to comment
Share on other sites


i386 for vista ? wrong forum place I think ...

btw you can make a batch

for %%? in (KB*.exe) do (
Start /wait "" %%? /integrate......
)

Put the .cmd in same folder as KB files and adjust the path for /integrate...

Link to comment
Share on other sites

Try this VBS Script, just place it in the folder where you have the updates.

Dim Fso  : Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Act : Set Act = CreateObject("Wscript.Shell")
Dim CD : CD = Fso.GetParentFolderName(WScript.ScriptFullName)
Dim XPCD : XPCD = "e:\WinDVD\" '<- Make Sure This Is The Correct path

Dim File,Folder,StrF
Set Folder = Fso.GetFolder(CD)
Set File = Folder.Files
'/-> Remove These Files And Folder Before Intergrate
If Fso.FileExists(XPCD & "i386\svcpack.inf") Then Fso.DeleteFile(XPCD & "i386\svcpack.inf") End If
If Fso.FileExists(XPCD & "i386\svcpack.in_") Then Fso.DeleteFile(XPCD & "i386\svcpack.in_") End If
If Fso.FolderExists(XPCD & "i386\svcpack") Then Fso.DeleteFolder(XPCD & "i386\svcpack") End If
For Each StrF In File
If InStr(StrF.Name,"KB") Or InStr(StrF.Name,"Kb") Or InStr(StrF.Name,"kb") Then
If InStr(StrF.Name,"exe") Or InStr(StrF.Name,"Exe") Or InStr(StrF.Name,"EXE") Then
Act.Run(strF.Name & " /quiet /norestart /L /o /integrate:" & XPCD),1,True
End If
End If
Next

Link to comment
Share on other sites

  • 2 weeks later...

Hello

Thanks Gunsmokingman !

I have tested your solution with VBS and i must tell that is the best and unique solution which work with all hotfix !

And otherwise, its respect microsoft integration conventions.

So, very great and useful vbs !!

just a question, is it possible to add a command to complete the dosnet.inf file ? to add the optional directory ?

thanks

Edited by KRYOGENIUS
Link to comment
Share on other sites

Hello

Thanks Gunsmokingman !

I have tested your solution with VBS and i must tell that is the best and unique solution which work with all hotfix !

And otherwise, its respect microsoft integration conventions.

So, very great and useful vbs !!

just a question, is it possible to add a command to complete the dosnet.inf file ? to add the optional directory ?

thanks

Yes that would be possible.

I have made one change to to the first script, it now set for %SystemDrive%\XPCD\

Dim Fso  : Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Act : Set Act = CreateObject("Wscript.Shell")
Dim CD : CD = Fso.GetParentFolderName(WScript.ScriptFullName)
'Dim XPCD : XPCD = "e:\WinDVD\" '<- Make Sure This Is The Correct path
Dim XPCD : XPCD = Act.ExpandEnvironmentStrings("%SystemDrive%\XPCD\") '<- %SystemDrive%
Dim File,Folder,StrF
Set Folder = Fso.GetFolder(CD)
Set File = Folder.Files
'/-> Remove These Files And Folder Before Intergrate
If Fso.FileExists(XPCD & "i386\svcpack.inf") Then Fso.DeleteFile(XPCD & "i386\svcpack.inf") End If
If Fso.FileExists(XPCD & "i386\svcpack.in_") Then Fso.DeleteFile(XPCD & "i386\svcpack.in_") End If
If Fso.FolderExists(XPCD & "i386\svcpack") Then Fso.DeleteFolder(XPCD & "i386\svcpack") End If
For Each StrF In File
If InStr(StrF.Name,"KB") Or InStr(StrF.Name,"Kb") Or InStr(StrF.Name,"kb") Then
If InStr(StrF.Name,"exe") Or InStr(StrF.Name,"Exe") Or InStr(StrF.Name,"EXE") Then
Act.Run(strF.Name & " /quiet /norestart /L /o /integrate:" & XPCD),1,True
End If
End If
Next

I have included the first script as a rar file so just extract it to where

you updates are located.

Edited by gunsmokingman
Link to comment
Share on other sites

wrote this http://www.msfn.org/board/index.php?showto...;p=279415 an eon or two ago.

@echo off
set sourcedir=h:\bootcd\working
set svcpackdir=%sourcedir%\i386\svcpack
echo Integrating Sevice Pack 2
if not exist %sourcedir%\win51ip.sp2 start /wait WindowsXP-KB835935-SP2-ENU.exe /integrate:%sourcedir% /q

for %%U in (KB??????.exe) DO (
if not exist %svcpackdir%\%%U (
echo integrating %%U
start /wait %%U /integrate:%sourcedir% /q
)
)

Echo FINISHED

pause

Link to comment
Share on other sites

Here is a VBS script that does this

1:\ Checks to make XPCD exists

2:\ Searches all the Local Hard Drive For Updates

3:\ Copies found Updates to a folder called %SystemDrive%\ZXP

4:\ Intergrates the updates

5:\ Clean up the files and folder

This runs silent except if

1:\ There is no XPCD

2:\ There are no updates

3:\ Message box when the script finishes

I have also included some filters to skip some updates that I have found to cause problems

when intergrating. This will not intergrate Service Pack 2

Save As SearchSlipKBQuiet.vbs

Dim StrComputer : StrComputer = "."
Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Act : Set Act = CreateObject("Wscript.Shell")
Dim Wmi : Set Wmi = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Dim XPCD : XPCD = Act.ExpandEnvironmentStrings("%SystemDrive%\XPCD\")
Dim ZXP : ZXP = Act.ExpandEnvironmentStrings("%SystemDrive%\ZXP\")
Dim GetF, File, StrF, ObjKB, StrKB
CheckForXPCD()
Function CheckForXPCD()
If Fso.FileExists(XPCD & "i386\ZONEOC.DL_") Then
SeachKB()
Else
MsgBox Space(19) & "Missing XPCD" & vbCrLf &_
"This Folder Was Not Found On " & XPCD & _
vbCrLf & "There Was No Source Folder To Intergrate" & vbCrLf &_
"When You Have Added The Source Folder" & vbCrLf &_
"Run This Script To Intergrate The Updates",4138,"Error No XPCD"
WScript.Quit
End if
End Function
Function SeachKB()
Set File = Wmi.ExecQuery("Select * from CIM_DataFile Where Extension = 'exe'")
For Each StrF In File
'-> Filter Out KB That Cause problems
Set GetF = Fso.GetFile(StrF.Name)
If InStr(GetF.Path,"883939") Or InStr(GetF.Path,"834707") Or InStr(GetF.Path,"885250") Or _
InStr(GetF.Path,"890923") Or InStr(GetF.Path,"896358") Or InStr(GetF.Path,"910437") Or _
InStr(GetF.Path,"911564") Or InStr(GetF.Path,"911565") Or InStr(GetF.Path,"911927") Or _
InStr(GetF.Path,"913433") Or InStr(GetF.Path,"913446") Or InStr(GetF.Path,"917734") Or _
InStr(GetF.Path,"893803") Or InStr(GetF.Path,"917344") Then
Else
If InStr(StrF.FileName,"KB") Or InStr(StrF.FileName,"Kb") Or InStr(StrF.FileName,"kb") Then
If InStr(GetF.Path,"svcpack") Then '-> Remove The XPCD Folder Updates
Else
If InStr(GetF.Name,0) Or InStr(GetF.Name,1) Or InStr(GetF.Name,2) Or _
InStr(GetF.Name,3) Or InStr(GetF.Name,4) Or InStr(GetF.Name,5) Or _
InStr(GetF.Name,6) Or InStr(GetF.Name,7) Or InStr(GetF.Name,8) Then
If InStr(GetF.Name,"835935") Then '-> Remove SP2 From Slip List
If File.Count = 0 Then
MsgBox "Could Not Find Any Updates, Down Load The Updates You" & vbCrLf &_
"Would Like To Intergrate In To Your Ua CD. After You" & vbCrLf &_
"Have Down Loaded The Updates. Then Re-Run This Script" & vbCrLf &_
"To Have Them Intergrated Into Your Ua XP CD",4128,"Error No updates"
WScript.Quit()
End If
Else
If Not Fso.FolderExists(ZXP) Then Fso.CreateFolder(ZXP)
If Fso.FileExists(ZXP & GetF.Name)Then '-> Prevent Double Copy
Else
GetF.Copy(ZXP & GetF.Name),True
End If
End If
End If
End If
End If
End If
Next
SlipKB()
End Function
Function SlipKB()
Set Folder = Fso.GetFolder(ZXP)
Set File = Folder.Files
'/-> Remove These Files And Folder Before Intergrate
If Fso.FileExists(XPCD & "i386\svcpack.inf") Then Fso.DeleteFile(XPCD & "i386\svcpack.inf") End If
If Fso.FileExists(XPCD & "i386\svcpack.in_") Then Fso.DeleteFile(XPCD & "i386\svcpack.in_") End If
If Fso.FolderExists(XPCD & "i386\svcpack") Then Fso.DeleteFolder(XPCD & "i386\svcpack") End If
For Each StrF In File
Act.Run(StrF.Path & " /quiet /norestart /L /o /integrate:" & XPCD),0,True
Fso.DeleteFile(StrF.Path)
Next
Folder.Delete()
MsgBox "Completed Intergration" ,4128,"Finish"
End Function

This is the same as the above except it produces a Log file of the intergrate process

Save As SearchSlipKBLog.vbs

Dim StrComputer : StrComputer = "."
Dim Fso : Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Act : Set Act = CreateObject("Wscript.Shell")
Dim Wmi : Set Wmi = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Dim XPCD : XPCD = Act.ExpandEnvironmentStrings("%SystemDrive%\XPCD\")
Dim ZXP : ZXP = Act.ExpandEnvironmentStrings("%SystemDrive%\ZXP\")
Dim GetF, File, StrF, ObjKB, StrKB
Dim Cnt, TS, Txt, Var1, Var2,Var3,Var4
Var1 = Space(2) & Chr(171) & " --------------------------------------------- " & Chr(187)
Var2 = Space(3) & Chr(187) & Chr(160)
Var3 = Chr(160) & Chr(187) & Space(3)
Txt = Act.ExpandEnvironmentStrings("%UserProfile%\Desktop\Kb_Report.txt")
CheckForXPCD()
Function CheckForXPCD()
If Fso.FileExists(XPCD & "i386\ZONEOC.DL_") Then
SeachKB()
Else
MsgBox Space(19) & "Missing XPCD" & vbCrLf &_
"This Folder Was Not Found On " & XPCD & _
vbCrLf & "There Was No Source Folder To Intergrate" & vbCrLf &_
"When You Have Added The Source Folder" & vbCrLf &_
"Run This Script To Intergrate The Updates",4138,"Error No XPCD"
WScript.Quit
End if
End Function
Function SeachKB()
Set File = Wmi.ExecQuery("Select * from CIM_DataFile Where Extension = 'exe'")
Set TS = Fso.CreateTextFile(Txt)
TS.WriteLine Var1 & vbCrLf & Var2 & Act.ExpandEnvironmentStrings("%ComputerName%")
TS.WriteLine Var2 & Date()
TS.WriteLine Var2 & "Begin Search For XP Updates " & Var3 & Time() & vbCrLf & Var1
TS.Close
For Each StrF In File
'-> Filter Out KB That Cause problems
Set GetF = Fso.GetFile(StrF.Name)
If InStr(GetF.Path,"883939") Or InStr(GetF.Path,"834707") Or InStr(GetF.Path,"885250") Or _
InStr(GetF.Path,"890923") Or InStr(GetF.Path,"896358") Or InStr(GetF.Path,"910437") Or _
InStr(GetF.Path,"911564") Or InStr(GetF.Path,"911565") Or InStr(GetF.Path,"911927") Or _
InStr(GetF.Path,"913433") Or InStr(GetF.Path,"913446") Or InStr(GetF.Path,"917734") Or _
InStr(GetF.Path,"893803") Or InStr(GetF.Path,"917344") Then
Else
If InStr(StrF.FileName,"KB") Or InStr(StrF.FileName,"Kb") Or InStr(StrF.FileName,"kb") Then
If InStr(GetF.Path,"svcpack") Then '-> Remove The XPCD Folder Updates
Else
If InStr(GetF.Name,0) Or InStr(GetF.Name,1) Or InStr(GetF.Name,2) Or _
InStr(GetF.Name,3) Or InStr(GetF.Name,4) Or InStr(GetF.Name,5) Or _
InStr(GetF.Name,6) Or InStr(GetF.Name,7) Or InStr(GetF.Name,8) Then
If InStr(GetF.Name,"835935") Then '-> Remove SP2 From Slip List
If File.Count = 0 Then '-> If No Updates are Found
MsgBox "Could Not Find Any Updates, Down Load The Updates You" & vbCrLf &_
"Would Like To Intergrate In To Your Ua CD. After You" & vbCrLf &_
"Have Down Loaded The Updates. Then Re-Run This Script" & vbCrLf &_
"To Have Them Intergrated Into Your Ua XP CD",4128,"Error No Updates"
WScript.Quit()
End If
Else
If Not Fso.FolderExists(ZXP) Then Fso.CreateFolder(ZXP)
If Fso.FileExists(ZXP & GetF.Name)Then '-> Prevent Double Copy
Else
GetF.Copy(ZXP & GetF.Name),True
CountKB()
Set TS = Fso.OpenTextFile(Txt,8)
TS.WriteLine Var2 & "Copy KB Path " & Var3 & GetF.Path
TS.WriteLine Var2 & "Copy KB Here " & Var3 & ZXP & GetF.Name & vbCrLf & Var1
TS.Close
End If
End If
End If
End If
End If
End If
Next
SlipKB()
End Function
Function SlipKB()
Dim FZ,MB,t1,t2,t3
Set Folder = Fso.GetFolder(ZXP)
Set File = Folder.Files
'/-> Remove These Files And Folder Before Intergrate
If Fso.FileExists(XPCD & "i386\svcpack.inf") Then Fso.DeleteFile(XPCD & "i386\svcpack.inf") End If
If Fso.FileExists(XPCD & "i386\svcpack.in_") Then Fso.DeleteFile(XPCD & "i386\svcpack.in_") End If
If Fso.FolderExists(XPCD & "i386\svcpack") Then Fso.DeleteFolder(XPCD & "i386\svcpack") End If
Set TS = Fso.OpenTextFile(Txt,8)
TS.WriteLine Var2 & "Copy Total" & Var3 & Cnt
TS.WriteLine Var2 & "Ended Search For XP Updates " & Var3 & Time() & vbCrLf & Var1
TS.WriteLine Var2 & "Start XP Updates Integration " & Var3 & Time() & vbCrLf & Var1
Cnt = 0
For Each StrF In File
CountKB()
t1 = Timer()
TS.WriteLine Var2 & "File Name " & Var3 & strF.Name
TS.WriteLine Var2 & "Start Time" & Var3 & Time()
TS.WriteLine Var2 & "File Count" & Var3 & Cnt
Act.Run(StrF.Path & " /quiet /norestart /L /o /integrate:" & XPCD),0,True
t2 = Timer : t3 = t2 - t1 : MB = 1024 * 1024 : FZ = Left(Round(strF.Size/MB,5),5)
TS.WriteLine Var2 & "File Size " & Var3 & FZ & " MB"
TS.WriteLine Var2 & "End Time " & Var3 & Time()
TS.WriteLine Var2 & "Run Time " & Var3 & Left(Round(t3,5),5) & " Seconds" & vbCrLf & Var1
Fso.DeleteFile(StrF.Path)
Next
TS.WriteLine Var2 & "Ended XP Updates Integration " & Var3 & Time() & vbCrLf & Var1
TS.Close
Folder.Delete()
Act.Run("Notepad.exe " & Txt),1,True
Dim ZZ1 : ZZ1 = MsgBox(_
"Would you like to keep this report Kb_Report.txt" & vbCrLf &_
Var2 & "Yes To Keep" & Space(3) & Var2 & "No To Delete",4132,"Keep Or Delete")
If ZZ1 = 7 Then Fso.DeleteFile(Txt) End If
End Function
Function CountKB()
Cnt = Cnt + 1
If Cnt > 99 Then
Cnt = Cnt
ElseIf Cnt = 99 Then
Cnt = "0" & Cnt
ElseIf Cnt > 9 Then
Cnt = "0" & Cnt
ElseIf Cnt = 9 Then
Cnt = "00" & Cnt
ElseIf Cnt < 9 Then
Cnt = "00" & Cnt
End If
End Function
Fso.DeleteFile(WScript.ScriptFullName),True

I have included a SFX of the SearchSlipKBLog.vbs

SearchSlipKBLog.exe

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