Some batch files for applying MS03-026

From: Ray (res0cu5i_at_verizon@net)
Date: 08/01/03


Date: Fri, 1 Aug 2003 12:13:40 -0400


     Don't shoot me for a cross-post.
     Here's a few scripts I wrote for deploying the MS03-026 patch, just in
case some systems might have been missed. The first batch file
(MS03-026_Win2k_Query.bat) uses a FOR loop to run a through a list of
servers (or IP Addresses) using the Resource Kit utility - SrvInfo.exe and
find all the Win2k systems. It then uses the SrvInfo.exe utility to create
a list of all the SP2 systems, then SP3 & SP 4 systems. The secondary batch
files (MS03-026_sp#_Query-Install.bat) are called to check if the patch has
already been applied; if not, another file (for service pack version) is
generated. The psexec.exe utlity (SysInternals) is used to copy & install
(unattended & no reboot) the patch to the remote system. We might have a
few desktop that are unpatched, so we weren't forcing a reboot. There is a
line that is REM'd out that will force a reboot via the SysInternals
utility - psshutdown.exe. The time is set at 900 seconds (15 minutes).
This was chosen so a message could be displayed with a phone number so it
could be requested the shutdown be aborted. Some of this same code (OS, sp
level & is hot fix already applied) can be adopted into a logon script.
There must be a "ToBeScanned.txt" file in the same folder as these batch
files, this is the list of systems or IP Addresses to be scanned. You will
also need Srvinfo.exe (Win2k ResKit), psshutdown.exe & psexec.exe
(www.sysinternals.com), the patch from MS and a "y.txt". The "y.txt" is
just a one-line text file that has a "y" on the first line, and a carriage
return. I"ve separated them out, so you can copy, paste & save as:
     MS03-026_Win2k_Query.bat
     MS03-026_Win2k_sp2_Query-Install.bat
     MS03-026_Win2k_sp3_Query-Install.bat
     MS03-026_Win2k_sp4_Query-Install.bat
Hopefully this will help patch your systems.

     Disclaimers: I'm not a programmer or heavy batch writer. Use these as
you own risk. I assume no responsibility for these files. MS supports
patching the current service pack & one level down. Apply this patch to
Win2k sp2 systems at your own risk.

(MS03-026_Win2k_Query.bat)
@Echo Off
REM
****************************************************************************
********
REM * Script Name: Windows 2000 MS03-026 patch query
REM * Author:
REM * Date Created: 8-1-03
REM * Notes:
REM * Supporting Files: Srvinfo.exe, ToBeScanned.txt
REM
****************************************************************************
********
REM Initialize the scripting environment
CLS
PROMPT $G
COLOR F1
TITLE Querying computer list for Windows 2000 systems and Service Pack
version
REM PATH %Path%;
SetLocal
REM
REM
****************************************************************************
********
REM Check for file containing the list of computers to be scanned.
REM
If Not Exist ToBeScanned.txt Goto ToBeScanned-is-Missing
REM
REM ****************************************************************
REM
REM Querying list of systems for Win2k systems
REM
Echo.
Echo Querying the supplied list for Win2k systems.
REM
If Exist Win2k.txt Del Win2k.txt < y.txt
@For /f %%q in (ToBeScanned.txt) do SrvInfo \\%%q | find "Product Name:
Microsoft Windows 2000" && Echo %%q >> Win2k.txt
REM
REM ****************************************************************
REM Query Win2k list for Service Pack 2 systems
REM
Echo.
Echo Querying Win2k systems for Service Pack2
REM
If Exist Win2k_sp2.txt Del Win2k_sp2.txt < y.txt
@For /f %%q in (Win2k.txt) do SrvInfo \\%%q | find "Build: 2195, Service
Pack 2" && Echo %%q >> Win2k_sp2.txt
REM
Start MS03-026_sp2_Query-Install.bat
REM
REM ****************************************************************
REM Query Win2k list for Service Pack 3 systems
REM
Echo.
Echo Querying Win2k systems for Service Pack 3
REM
If Exist Win2k_sp3.txt Del Win2k_sp3.txt < y.txt
@For /f %%q in (Win2k.txt) do SrvInfo \\%%q | find "Build: 2195, Service
Pack 3" && Echo %%q >> Win2k_sp3.txt
REM
Start MS03-026_sp3_Query-Install.bat
REM
REM ****************************************************************
REM Query Win2k list for Service Pack 4 systems
REM
Echo.
Echo Querying Win2k systems for Service Pack 4
REM
If Exist Win2k_sp4.txt Del Win2k_sp4.txt < y.txt
@For /f %%q in (Win2k.txt) do SrvInfo \\%%q | find "Build: 2195, Service
Pack 4" && Echo %%q >> Win2k_sp4.txt
REM
Start MS03-026_sp4_Query-Install.bat
REM
Goto EOF
REM
REM ****************************************************************
:ToBeScanned-is-Missing
CLS
Echo.
Echo The file containing the list of systems to be querried is missing.
Echo.
Echo Please check the current directory for the following file -
ToBeScanned.txt
Echo.
Goto EOF
REM ****************************************************************
:EOF
Pause

(MS03-026_Win2k_sp2_Query-Install.bat)
@Echo Off
REM
****************************************************************************
********
REM * Script Name: MS03-026 SP2 hot-fix query and install
REM * Author:
REM * Date Created: 8-1-03
REM * Notes:
REM * Supporting Files: Srvinfo.exe, PSExec.exe, MS03-026 hot-fix
(KB823980), PSShutdown
REM
****************************************************************************
********
REM Initialize the scripting environment
CLS
PROMPT $G
COLOR F1
TITLE MS03-026 Service Pack 2 hot-fix query and installation.
REM PATH %Path%;
SetLocal
REM
REM
****************************************************************************
********
REM Find unpatched Win2k Service Pack 2 systems
REM
Echo.
Echo Querying the list of Win2k sp2 systems for the presence of MS03-026
REM
If Exist Win2k_sp2_Unpatched.txt Del Win2k_sp2_Unpatched.txt < y.txt
@For /f %%q in (Win2k_sp2.txt) do SrvInfo.exe \\%%q | find "[KB823980]:" ||
Echo %%q >> Win2k_sp2_Unpatched.txt
REM
REM ****************************************************************
REM Deploy patch to unpatched Win2k Service Pack 2 systems
REM
Echo.
Echo Deploying MS03-026 (KB823980) to the unpatched Win2k sp2 systems.
REM
@If Exist Win2k_sp2_Unpatched.txt For /f %%q in (Win2k_sp2_Unpatched.txt) do
PSExec.exe \\%%q -c Windows2000-KB823980-x86-ENU.exe -u -q -z
REM
REM ****************************************************************
REM Force reboot of patched systems to complete patch installation
REM
REM Echo.
REM Echo The patched systems will be rebooted.
REM
REM @For /f %%q in (Win2k_sp2_Unpatched.txt) do PSShutdown.exe -t 900 -m "
" -f -r \\%%q
REM
REM ****************************************************************
REM
Echo.
Echo The Win2k sp2 systems have had the MS03-026 patch applied.
Echo.
Echo Please reboot these systems (see Win2k_sp2_Unpatched.txt) to complete
the patch installation.
REM
REM Echo The Win2k sp2 systems have had the MS03-026 patch applied and
rebooted.
Echo.
Pause

(MS03-026_Win2k_sp3_Query-Install.bat)
@Echo Off
REM
****************************************************************************
********
REM * Script Name: MS03-026 SP3 hot-fix query and install
REM * Author:
REM * Date Created: 8-1-03
REM * Notes:
REM * Supporting Files: Srvinfo.exe, PSExec.exe, MS03-026 hot-fix
(KB823980), PSShutdown
REM
****************************************************************************
********
REM Initialize the scripting environment
CLS
PROMPT $G
COLOR F1
TITLE MS03-026 Service Pack 3 hot-fix query and installation.
REM PATH %Path%;
SetLocal
REM
REM
****************************************************************************
********
REM Find unpatched Win2k Service Pack 3 systems
REM
Echo.
Echo Querying the list of Win2k sp3 systems for the presence of MS03-026
REM
If Exist Win2k_sp3_Unpatched.txt Del Win2k_sp3_Unpatched.txt < y.txt
@For /f %%q in (Win2k_sp3.txt) do SrvInfo.exe \\%%q | find "[KB823980]:" ||
Echo %%q >> Win2k_sp3_Unpatched.txt
REM
REM ****************************************************************
REM Deploy patch to unpatched Win2k Service Pack 3 systems
REM
Echo.
Echo Deploying MS03-026 (KB823980) to the unpatched Win2k sp2 systems.
REM
@If Exist Win2k_sp3_Unpatched.txt For /f %%q in (Win2k_sp3_Unpatched.txt) do
PSExec.exe \\%%q -c Windows2000-KB823980-x86-ENU.exe -u -q -z
REM
REM ****************************************************************
REM Force reboot of patched systems to complete patch installation
REM
REM Echo.
REM Echo The patched systems will be rebooted.
REM
REM @For /f %%q in (Win2k_sp3_Unpatched.txt) do PSShutdown.exe -t 900 -m "
" -f -r \\%%q
REM
REM ****************************************************************
REM
Echo.
Echo The Win2k sp3 systems have had the MS03-026 patch applied.
Echo.
Echo Please reboot these systems (see Win2k_sp3_Unpatched.txt) to complete
the patch installation.
REM
REM Echo The Win2k sp3 systems have had the MS03-026 patch applied and
rebooted.
Echo.
Pause

(MS03-026_Win2k_sp4_Query-Install.bat)
@Echo Off
REM
****************************************************************************
********
REM * Script Name: MS03-026 SP4 hot-fix query and install
REM * Author:
REM * Date Created: 8-1-03
REM * Notes:
REM * Supporting Files: Srvinfo.exe, PSExec.exe, MS03-026 hot-fix
(KB823980), PSShutdown
REM
****************************************************************************
********
REM Initialize the scripting environment
CLS
PROMPT $G
COLOR F1
TITLE MS03-026 Service Pack 4 hot-fix query and installation.
REM PATH %Path%;
SetLocal
REM
REM
****************************************************************************
********
REM Find unpatched Win2k Service Pack 4 systems
REM
Echo.
Echo Querying the list of Win2k sp4 systems for the presence of MS03-026
REM
If Exist Win2k_sp4_Unpatched.txt Del Win2k_sp4_Unpatched.txt < y.txt
@For /f %%q in (Win2k_sp4.txt) do SrvInfo.exe \\%%q | find "[KB823980]:" ||
Echo %%q >> Win2k_sp4_Unpatched.txt
REM
REM ****************************************************************
REM Deploy patch to unpatched Win2k Service Pack 4 systems
REM
Echo.
Echo Deploying MS03-026 (KB823980) to the unpatched Win2k sp2 systems.
REM
@If Exist Win2k_sp4_Unpatched.txt For /f %%q in (Win2k_sp4_Unpatched.txt) do
PSExec.exe \\%%q -c Windows2000-KB823980-x86-ENU.exe -u -q -z
REM
REM ****************************************************************
REM Force reboot of patched systems to complete patch installation
REM
REM Echo.
REM Echo The patched systems will be rebooted.
REM
REM @For /f %%q in (Win2k_sp4_Unpatched.txt) do PSShutdown.exe -t 900 -m "
" -f -r \\%%q
REM
REM ****************************************************************
REM
Echo.
Echo The Win2k sp4 systems have had the MS03-026 patch applied.
Echo.
Echo Please reboot these systems (see Win2k_sp4_Unpatched.txt) to complete
the patch installation.
REM
REM Echo The Win2k sp2 systems have had the MS03-026 patch applied and
rebooted.
Echo.
Pause



Relevant Pages

  • Re: Compiled ocx file reports different sizes
    ... Rem Set Resource Compiler path ... goto checkMIDL ... echo VC_HOME is set incorrectly. ... echo Step 2: Compiling Resource file ...
    (microsoft.public.vc.mfc)
  • RE: Help for Windows Vista.
    ... just add a username and password to your command. ... Echo Loggin into our company ... REM *** drev w ... Did you run the Script as Administrator? ...
    (microsoft.public.windows.vista.general)
  • Re: Rename multiple files?
    ... So Microsoft's wildcards won't let you prefix characters before the wildcard position and apparently retains the length of the substring that it parsed out. ... echo Execute: "%0" ... rem - environment variables, especially needed inside for-loops. ...
    (microsoft.public.windowsxp.basics)
  • Re: I want all those MP3 files out of my file server
    ... The third column is his supervisor's EMail prefix. ... @echo off ... rem It must be in this format: ... 34 echo This is an automatic message from the disk space monitor.>> ...
    (microsoft.public.win2000.general)
  • Re: Looking for a Dos C or Windows C++ programmer to patch a program
    ... I haven't tried the speed change yet, I just downloaded the new windows file. ... But here it the A2 patch to be applied to ADT 1.22 to make it 1.22E and have the 115k option in place of the 4800 baud rate. ... REM PATCH FOR ADT 1.22 TO ALLOW ...
    (comp.sys.apple2.programmer)