zorg2000k Posted May 30, 2007 Posted May 30, 2007 Hi,Finally got my work batch file for patching up and running covering XPSp1 / XPSp2 / 3 version's of Office / Visio / Project.Have a question though.My script is now a meaty 14 pages long . Is it possible to reduce my script in someway with regards to the following :My Xp patches call the followingcd MS06-011call XP.batcd..cd MS06-014call XP.batcd..cd MS06-015call XP.batcd..cd MS06-018call XP.batcd..cd MS06-022call XP.batcd..etc. All the way down to Ms07.Any thoughts ?Cheers in advance.Zorg
Yzöwl Posted May 30, 2007 Posted May 30, 2007 A quick example:FOR /F "DELIMS=" %%? IN ('DIR/B/AD^|FINDSTR/I MS0[67]-[0-9]*') DO ( IF EXIST %%?\XP.BAT CALL %%?\XP.BAT)
jondercik Posted May 30, 2007 Posted May 30, 2007 Why not just use nLite to integrate the patches as well? Also, why does it file have its own directory?
IcemanND Posted May 30, 2007 Posted May 30, 2007 ouch. take all the executables and put them in one folder. Then use a for loop to loop through them all like Ywozl did for going trough the folders, or create a CMD file calling each on individually.
zorg2000k Posted May 31, 2007 Author Posted May 31, 2007 A quick example:FOR /F "DELIMS=" %%? IN ('DIR/B/AD^|FINDSTR/I MS0[67]-[0-9]*') DO ( IF EXIST %%?\XP.BAT CALL %%?\XP.BAT)Thanks for this. Looks good will need to test now.
zorg2000k Posted May 31, 2007 Author Posted May 31, 2007 Why not just use nLite to integrate the patches as well? Also, why does it file have its own directory?Our base OSD build get's updated every three months with all MS patches. We are implementing ITMU within the next three months but need to continue patching our existing estate of 15000 machines.Own dir for each patch just to make it easier to maintain.This is a copy of a standard XP.bat file.Echo off%windir%\system32\reg.exe QUERY "HKLM\SOFTWARE\Microsoft\Updates\Windows XP\SP3\KB923694" /v Description | %windir%\system32\find.exe "923694" && goto out%windir%\system32\reg.exe QUERY "HKLM\SOFTWARE\Microsoft\Updates\Outlook Express 6\SP1\KB923694-OE6SP1-20061106.120000" /v Description | %windir%\system32\find.exe "923694" && goto out%windir%\system32\reg.exe QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CSDVersion | %windir%\system32\find.exe "Service Pack 2" && goto xpsp2patch:xppatchKB923694_OE6.0sp1.exe /QUIET /NORESTART goto end:xpsp2patchKB923694_SP2.exe /QUIET /NORESTART :end%windir%\system32\reg.exe add HKLM\Software\GDS\VersionControl\PatchControl /v Reboot_Pending /t REG_SZ /d 1 /f:out%windir%\system32\xcopy.exe /Y KB923694.exe c:\smsinstallgoto finish:NotReq%windir%\system32\xcopy.exe /Y KB923694NA.exe c:\smsinstall:finishThese files are added for reporting purpose as our SMS server only reports on .EXE's. due to bandwith issues.%windir%\system32\xcopy.exe /Y KB923694.exe c:\smsinstall%windir%\system32\xcopy.exe /Y KB923694NA.exe c:\smsinstall
zorg2000k Posted May 31, 2007 Author Posted May 31, 2007 A quick example:FOR /F "DELIMS=" %%? IN ('DIR/B/AD^|FINDSTR/I MS0[67]-[0-9]*') DO ( IF EXIST %%?\XP.BAT CALL %%?\XP.BAT)Hi,Could you explain the above script as it is not working correctly.CheersZorg
Yzöwl Posted May 31, 2007 Posted May 31, 2007 Yes!The batch searches the current directory for all directories named MS06-<any numbers> or MS07-<any numbers>. Any XP.bat file found in any matching directory is called.I created a 'test setup' in order to verify that the batch works!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now