Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


December 13, 2004

Script to Deploy Patches

RSS
View this exclusive article with VIP access -- click here to join |
See More Hotfixes Articles Here | Reprints | Or sign up for our VIP Monthly Pass!

Download the Code Here

Script to Deploy Patches
Using third-party applications to deploy hotfixes can be expensive. Although Microsoft Software Update Services (SUS) is free, SUS has additional server requirements that might be cost-prohibitive in small organizations. SUS also requires unpatched machines to be on the network, which opens the door for existing worms to wreak havoc.

As an alternative, I wrote the script Patch.bat to automate system patching on Windows 2000. Listing 2 shows a portion of this script. (You can download the entire script from the Windows Scripting Solutions Web site. Go to http://www.windowsitpro.com/ windowsscripting, enter InstantDoc ID 44603 in the InstantDoc ID text box, then click the 44603.zip hotlink.) Patch.bat is especially handy for using removable media to patch newly imaged systems as part of a build process. You can also use Patch.bat with domain logon scripts to deploy hotfixes without relying on manual patching or using Sysinternals' PsExec. Although Patch.bat works only on Win2K, you can download scripts that work on other OSs from my Web site (http://winpatch.homeip.net). If you're unsure of your machine's OS, my Web site also includes a script called OS Detection that can provide the OS information.

Patch.bat requires DirectX 7.0 (installed by default on Win2K), the Microsoft Windows NT Server 4.0 Resource Kit's reg.exe utility (to look for specific hotfix-related registry subkeys), and the UNIX sleep.exe utility. (The resource kit also includes sleep.exe.) If the necessary subkeys don't exist, the script uses a noninteractive mode (i.e., no restart necessary) to apply patches, then uses qchain.exe to chain hotfixes together at the end. The script skips reinstalling hotfixes for hotfix subkeys that already exist. In the script, .\ causes the script to be sensitive to the directory it runs in.

Patch.bat still requires tweaking, such as checking for consistent registry subkeys between patches (although I used the subkeys listed in the Microsoft Security Bulletins). You can easily edit the script's code to suit your environment. You'll also need to revise the script each time Microsoft releases a new patch update. As long as your company has a security policy that ensures remote clients log on to the VPN as soon as they connect to the Internet, you can also use the script to patch remote user systems.

End of Article



Reader Comments

You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

How can I stop and start services from the command line?

...

Microsoft Touts Xbox 360 'Black Friday' Success

Microsoft this week revealed that its Xbox 360 video game console outsold its Sony PlayStation 3 rival 3-to-1 on "Black Friday," which curiously describes the three day weekend after Thanksgiving, a period that unofficially kicks off the holiday selling ...


Related Articles Use Mbsacli.exe to Get Patch Requirements from Remote Servers

Related Events Windows, Unix, Linux Interoperability

Check out our list of Free Email Newsletters!

Scripting eBooks Keeping Your Business Safe from Attack: Encryption and Certificate Services

Best Practices for Managing Linux and UNIX Servers

Building an Effective Reporting System

Related Scripting Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing