Subscribe to Windows IT Pro

 

Get Newsletters

  • Get the Latest News
  • Product Updates
  • Helpful Tricks
  • Productivity Tips

Subscribe Now!

December 13, 2004 12:00 AM

Script to Deploy Patches

Windows IT Pro
InstantDoc ID #44603
Rating: (0)
Downloads
44603.zip

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.

Related Content:

ARTICLE TOOLS

Comments
    There are no comments to display. Be the first one!
You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

White Papers

Get your Windows 7 deployment off to the right start by implementing PC lockdown. A locked-down environment is easier and cheaper to support since users are less likely to make unnecessary changes to the core system configuration - read more here!

Essential Guides

Is your iSCSI "lossy"? The reality is that most off-the-shelf Ethernet hardware deployed for iSCSI can lose packets, resulting in slow performance or application downtime. Learn how to assess your current iSCSI infrastructure and engineer an advanced iSCSI SAN infrastructure.

Web Seminars

What's the best way to keep your network safe from malware? In this web seminar, security expert Greg Shields suggests an alternative method to the traditional blacklisting approach that is common with anti-virus and anti-malware solutions.

eLearning Series

We bring the experts direct to you to share their real-world perspective and expertise. During each event, three sessions stream in real time, so you can learn, ask questions, and get solutions.
Upcoming event: Getting the Most with Exchange 2010 with Paul Robichaux

Subscribe to Windows IT Pro!

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.