Reader to Reader - 22 Nov 1999

This month, one scripting solution is provided: How to Manage Your Printer Migration with KiXtart

Readers

November 22, 1999

2 Min Read
ITPro Today logo in a gray background | ITPro Today


[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 receive $100.]

I led a migration from Novell NetWare to Windows NT. One daunting task I faced was moving the users from NetWare printers to NT printers. I managed the process with a printer migration script. I wrote this script with KiXtart because the main logon script uses this scripting language. (For more information about the KiXtart scripting language, see Gregg Branham, "Creating Logon Scripts with KiXtart," February 1999.)

The main KiXtart logon script prompted the printer migration script to execute if a user was a member of a global group called netware printer migration. I periodically changed who was in that group, thereby controlling when I migrated each user's printer.

Listing 1 contains an excerpt from the printer migration script. You can find the entire script on the Win32 Scripting Journal Web site (http://www.winntmag.com/newsletter/scripting). Here's how the printer migration script works. When a user logs on, the script first reads the Registry, determines the name of the default NetWare printer, and assigns that name to the variable $printtrunc. (For more information about using KiXtart to manipulate the Registry, see Jon McDonald, "Manipulate the Registry and Access Files with KiXtart," April 1999.) Through a series of If statements, the script selects a suitable NT printer. The script then sets the name of the new NT printer to the $remap variable. Finally, the script adds the new printer connection and sets that connection as the default.

A log file captures error trap information to track the results. When the script executes, it copies the log file to a shared directory on the network so that you can view the file remotely. If the script successfully remaps a printer, the script names the log file username.txt. If an error occurs, the script names the log file e_username.txt. This approach lets you easily detect any problems. After reading the log files and seeing that all the users have successfully migrated, you can remove the files from the queue.

—Brian Guilfoyle
[email protected]

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like