Automating Tasks After Mini-Setup

Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2

You can automatically install software and run commands, programs, scripts, and batch files after Mini-Setup runs and the computer restarts by using the [GuiRunOnce] section in Sysprep.inf. All of the tasks listed in the [GuiRunOnce] section of a Sysprep.inf file are stored in the following registry subkey:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Runonce

When a computer is started for the first time after Mini-Setup, the commands listed in the [GuiRunOnce] section are read from the registry and executed.

Automate tasks by using the [GuiRunOnce] section in Sysprep.inf if you need:

  • Choice of security context. You can install software and run programs, scripts, and batch files under the context of an end user or a local Administrator account.

  • Network access. You can access network resources, such as shared folders and drives.

  • Server configuration support. You can install Cluster service and configure domain controllers.

  • Active Directory support. You can access Active Directory, depending on the security context of the logged-on user.

On the other hand, automating tasks by using the [GuiRunOnce] section in Sysprep.inf has one key disadvantage: longer startup time for end users. End users must wait for the tasks specified in the [GuiRunOnce] section to run before they can access their computers.

You can configure the [GuiRunOnce] section in a Sysprep.inf file either by using Setup Manager or by using a text editor such as Notepad. Setup Manager prompts you for commands, programs, scripts, or batch files that you want to run after Mini-Setup runs and a computer restarts. Your answers are saved in the [GuiRunOnce] section of a Sysprep.inf file. Setup Manager is included in the Deploy.cab file in the Support folder on the Windows Server 2003 operating system CD. For more information about using Setup Manager, see the Microsoft Windows Corporate Deployment Tools User’s Guide (Deploy.chm). Deploy.chm is included in the Deploy.cab file in the Support folder on the Windows Server 2003 operating system CD.

To design automated installation tasks that occur after Mini-Setup, you must identify:

  • The installation tasks you want to automate.

  • The configuration files you need to use.

  • The settings you need to configure for each configuration file.

Identifying Automated Installation Tasks You Can Perform After Mini-Setup

You can use each copy of the "Disk Imaging Worksheet" (ACISYS_1.doc) to identify the installation tasks you need to perform after each of your disk images is copied onto a destination computer. If you have not created a worksheet for each of your disk images, identify the installation and configuration tasks that need to be performed after each of your disk images is copied onto a destination computer.

Next, use Table 3.11 to determine which installation tasks to automate after Mini-Setup. If possible, try to automate tasks before Mini-Setup by using Factory mode and a Winbom.ini file.

Table 3.11   Installation Tasks You Can Automate After Mini-Setup

Installation Task Comments

Install software

Software installation tasks are run under either the end user or local Administrator account.

Run commands, programs, scripts, and batch files

Commands, programs, scripts, and batch files are run under the security context of the end user or the local Administrator account.

Identifying Configuration Files to Use After Mini-Setup

You might have to configure several answer files or configuration files if you automate installation tasks after Mini-Setup. Table 3.12 describes these answer files and configuration files, and explains where you need to save them.

Table 3.12   Configuration Files Used to Automate Tasks After Mini-Setup

Configuration File Description Where to Save the Configuration File

Sysprep.inf

Primarily the answer file for Mini-Setup, but can also be used to run programs, scripts, or batch files after Mini-Setup runs and a destination computer restarts. To do this, you must include the programs, scripts, or batch files in the [GuiRunOnce] section of Sysprep.inf.

Must be saved in the same location as Sysprep.exe and Setupcl.exe, which are in the systemdrive\Sysprep folder on the destination computer.

filename.txt*

Answer file for programs or scripts that run after Mini-Setup and a computer restarts. This includes answer files for software installation (setup) programs.

Same location as the program or script that you need to run without user intervention after Mini-Setup.

* Where filename can be any valid file name you choose.

You can use different Sysprep.inf files with a single disk image by copying Sysprep.inf to the *systemdrive\*Sysprep folder after you copy the disk image to a destination computer. The easiest way to do this is to start the destination computer in Factory mode, and then copy the appropriate Sysprep.inf file from a shared folder to the *systemdrive\*Sysprep folder. You can also use a disk-imaging application to copy files onto a disk image after the disk image has been created, although not all disk-imaging programs provide this functionality.

Note

  • You can also save Sysprep.inf on a floppy disk with Sysprep.exe and Setupcl.exe; however, the floppy disk controller on the master computer must be identical to the floppy disk controller on the destination computer. If the floppy disk controllers are different, the Setup program will not find the floppy disk controller on the destination computer, and the automated tasks and settings specified in Sysprep.inf will fail.

For more information about using Sysprep.inf and Cmdlines.txt files, see the Microsoft Windows Corporate Deployment Tools User’s Guide (Deploy.chm), which is included in the Deploy.cab file in the Support folder on the Windows Server 2003 operating system CD. For more information about how to configure an answer file for a program or script, see the documentation for the program or script.

Identifying Configuration File Settings to Use After Mini-Setup

To run programs, scripts, or batch files after Mini-Setup runs and a destination computer restarts, you must use the [GuiRunOnce] section of Sysprep.inf. Programs, scripts, and batch files that are run using the [GuiRunOnce]section run in the context of the currently logged-on end user. If the end user does not have the necessary user rights to run the program, script, or batch file completely, the application fails. Because programs, scripts, and batch files are run in the context of a logged-on end user rather than as a service, the registry entries that the application creates are written for the current end user rather than the default user. (Default user registry settings are propagated to new end users.) If you want any settings and updates to show specifically for the logged-on end user only, using the [GuiRunOnce] section is appropriate. Otherwise, you can use Cmdlines.txt to run applications because it runs programs, scripts, and batch files under the context of the Local System security account.

For more information about configuring the [GuiRunOnce] section in Sysprep.inf, see the Microsoft Windows Corporate Deployment Tools User’s Guide (Deploy.chm). Deploy.chm is included in the Deploy.cab file in the Support folder on the Windows Server 2003 operating system CD.