\[Editor's note: Email your scripting solutions (400 words or less) to Reader to Reader at [email protected] Please include your script and phone number. We'll edit submissions for style, grammar, and length. If we print your contribution, you get $100.\]
I had to upgrade Microsoft Internet Explorer (IE) at my company's sites. I used Microsoft Systems Management Server (SMS) to distribute the software upgrade to all the sites, except one. This particular site was having problems with the SMS database. I didn't want to wait until the site fixed the database, so I decided to upgrade IE without SMS.
I used the Netdom, Shutdown, and Reg utilities from the Microsoft Windows NT Server 4.0 Resource Kit. I first copied the SMS package to a server in the site and put these resource kit utilities in the same directory. Then, I created a user account with read permissions into the package's directory. Next, I created five command files:
RUpdate. RUpdate first creates a file (%1.wks) containing a list of workstation names in the desired domain (%1). RUpdate then uses the For command to read each workstation name in the file and calls the TestWorkstation command file for each workstation.
TestWorkstation. TestWorkstation calls the Verify command file to test whether that workstation is turned on. If the workstation isn't on, TestWorkstation generates an error message. If the workstation is on, TestWorkstation calls the Update command file.
Update. Update first copies a startup file, LUpdate, to the common \Winnt\Profiles\All Users\Start Menu\Programs\Startup group in the workstation. Update then enables the AutoAdminLogon feature, after which it uses the Shutdown utility to restart the workstation. (You need the workstation administrator's password for this command file. My company uses a standard password for all workstations, so hard-coding this password was easy.)
LUpdate. LUpdate is run when the system restarts. LUpdate uses the Netdom utility to connect to the package server's directory. LUpdate calls the UpdateMe command file.
UpdateMe. After giving the user a warning that an update is in progress, this file executes the IE update. UpdateMe then turns off the AutoAdminLogon feature, erases the file in the common Startup group, and restarts the workstation.
You can find these five command files on the Win32 Scripting Journal Web site. Together, they provide an update tool for remote workstations.
—Reginaldo L. Araujo