Automating installations with the Sysprep tool

Sysprep can make multiple PC installations (from a single image) a snap. In this Daily Drill Down, Talainia Posey helps you make this installation automatic and fast.

In part one of this series, “Working with the Sysprep tool, part 1,” I introduced you to Sysprep, a tool used for duplicating hard disk images to new PCs. In that Daily Drill Down, I discussed some of the hardware issues that you'll encounter and explained how to install the Sysprep tool.

In this Daily Drill Down, I'll continue the discussion by explaining what you need to know before running the Sysprep tool and how to create an .ini file to make the installation job a lot less time-consuming.

Before you begin
Before you run the Sysprep tool, you have a few choices to make. The biggest choice is what the client-side experience will be like. As you may recall from part one, although Sysprep is designed to help you to duplicate a hard disk image, the disk image that you're duplicating is incomplete. For example, the PC you created the image from hadn't been joined to a domain yet. Therefore, it stands to reason that if you create a disk image from a PC with an incomplete configuration, the configuration on the new PC you're setting up will also be incomplete. There are two ways the Sysprep tool can deal with the missing portions of the configuration on the new PCs.

By default, when you first boot a system that you've copied an image file to, the new computer will run the Sysprep tool. It can do this because it will contain a Sysprep folder with a copy of the Sysprep tool, just like the original PC. When the Sysprep tool runs on the new PC, it will launch the Mini Setup Wizard. The Mini Setup Wizard is similar to the Setup program that you use to initially install Windows 2000 on a new system. There are some differences, though. One big difference is speed. Because all of the necessary files already exist on the new PC, you won't have to wait for a million files to be copied from the installation CD. Another big difference is that you're asked fewer questions than during a real setup. That's because half of the configuration process has already been completed and the Mini Setup Wizard only needs you to enter things like a computer name and a domain name.

The other option when using the Sysprep tool to prepare a client is to use a text file to fill in most of the blanks. Before you can really create an effective text file, though, you need to know the steps the Mini Setup Wizard goes through. When the Mini Setup Wizard first runs, you'll see the Welcome To Windows 2000 Professional Setup screen, followed by the End User License Agreement (EULA) screen. Both of these screens must be manually acknowledged.

Once you've gotten past these screens, you get into the real heart and soul of the Mini Setup Wizard. You'll see screens that ask you to fill in regional options, the user and company name, the product key number, the computer name, and the local administrator's password.

Once you've entered this information, you may be asked to enter some Telephony Application Programming Interface (TAPI) settings. You'll only have to do this if a modem is installed in your system.

Finally, you'll be asked to enter the date and time, followed by the network settings and the name of the workgroup or domain that you want to join (assuming that you're on a network).

Creating an answer file
As you can see, answering all of these questions on every computer that you're setting up could turn into a lot of work. This is where creating an answer file comes in. If you create an answer file, you'll never have to deal with most of these questions.

Creating an answer file involves creating a text file named Sysprep.inf. This text file uses the same basic format as an .ini file. It contains section headings, keys, and values. Unfortunately, space doesn't permit me to thoroughly cover all of the options that you can use in this text file. I will discuss some of the more common and useful answer file parameters. If you need functionality beyond what I've provided, you can find an exhaustive list of answer file options on the Windows 2000 CD. To access this comprehensive list, navigate through your Windows 2000 Professional installation CD's directory structure and go to the \Support\Tools directory. Now, decompress the file and open the Unattended.doc file. This file will show you the syntax for every available option you can use in the Sysprep.inf file.

Coding the answer file
Now that you know a little about where to go for more information, let's look at the basics of the Sysprep.inf file. As I mentioned earlier, the first thing that the Mini Setup Wizard attempts to do is display a welcome screen and an end user license agreement. Even though you don't actually have to fill in any information on these screens, you do have to click the mouse to bypass the welcome screen and to accept the license agreement. While this may not sound like a big deal, it can be a nuisance if you have a lot of computers to configure. Therefore, I recommend configuring your Sysprep.inf file to force Windows to bypass these steps of the Mini Setup Wizard. To do so, start the Sysprep.inf file with these lines of code. In this code segment, the UnattendedMode key tells Windows to run Setup in full unattended mode. This means that Setup won't pause for anything, including errors. This line is optional, but it's a good idea to use it if you have a lot of machines to set up and you don't want to have to worry about checking up on them. The OemSkipEula command tells the Mini Setup Wizard not to display the license agreement.

Before I go any further, it's important to point out that the file I'm showing you how to create is intended only for brand-new PCs that don't contain an operating system. If you need to upgrade from another operating system, such as Windows NT or Windows 9x, there will be other tasks that you'll need to complete before addressing any of the questions the Mini Setup Wizard asks. These tasks include setting a page file size, upgrading the hard disk's partitions to NTFS, and extending the partition, if necessary (among many others). In part three, I'll explain some other things you'll need to do when upgrading another operating system. For now, though, I'll assume that you're setting up a new PC.

With that said, here are some more commands you might include in your Sysprep.inf file. Notice that each of the commands addresses one of the Setup questions I mentioned earlier.
AdminPassword = ''password''
TimeZone = 35
OemSkipWelcome = 1
OemSkipRegional = 1

[User Data]
FullName = ''Talainia Posey''
OrgName = ''Posey Enterprises''
ComputerName = new_computer

JoinDomain = Bud2000

InstallDefaultComponents = Yes

In the GuiUnattended section, there are four commands that address basic setup issues. First, I've used the AdminPassword command to specify an administrative password. This line only works if the administrative password was blank on the system that you used to create the master image file. I should also mention that even though this password only applies to the local system (this command doesn't affect the domain administrator's password), you might consider omitting the line and setting the password manually. Your password appears as readable text within your Sysprep.inf file. Anyone who happens to get access to a copy of this file can easily find out the administrative password used on all of the workstations.

The next command in this section is the TimeZone command. In this example, I've set the time zone to 35, which corresponds to the East Coast of the United States. The code for the West Coast is four. If you live in the United States, you can use 10 for Mountain time and 20 for Central time. If you need other time zone codes, you can find them in the Unattended.doc file.

Below the TimeZone command are two other commands: OemSkipWelcome and OemSkipRegional. You'll notice that both of these commands have a value of 1. A value of 1 is equivalent to Yes, while a value of 0 is equal to No. Therefore, the command OemSkipWelcome=1 command tells Windows to skip the initial welcome screen. Likewise, the OemSkipRegional command tells Windows to skip the portion of the Mini Setup Wizard that deals with the regional settings.

The next section you'll encounter is the User Data section. This section provides the data for customizing the new system with things like a user name and computer name. As you can see in the code above, the FullName= command is where you provide the name of the user who will be using the machine. The OrgName= section is used to specify the name of your company. Finally, the ComputerName= section is used for providing a unique computer name.

Below the User Data section is the Identification section. This tells the Mini Setup Wizard which domain or workgroup the system will become a part of. I've used the JoinDomain= command to join a domain. There are commands that you can use to join a workgroup. However, if you're going through all of this trouble to use the Sysprep utility, then you've probably got too many machines for a workgroup, anyway.

Beneath the Identification section, you'll find the Networking section. In my example file, I've simply used InstallDefaultComponents = Yes to tell the Mini Setup Wizard to install the more common networking components. You can use more specific commands to control exactly what gets installed, but space doesn't permit me to do so here. If you need to know the syntax for these more specific commands, you can find it in the Unattended.doc file.

Putting it all together
So far, I've covered most aspects of the Sysprep tool, but I've still left two big questions unanswered. First, how does the actual duplication work, and second, how do you tell the Mini Setup Wizard to use the answer file?

The reason I haven't really talked about the duplication process is that Sysprep doesn't duplicate the hard disk. All Sysprep does is build an image file. You must then use a third-party utility to copy the image file and the Sysprep files to the new hard disk. Once it’s on the new hard disk, you can run Sysprep again to begin extracting data from the image file.

So what about using the answer file? There are a couple of ways to use the answer file. The easiest method is to copy the answer file to a floppy disk. Once you've copied the answer file to a startup disk, boot the new machine and insert the disk as soon as the Windows Setup screen appears. Windows will do the rest.

Editor's Picks