Configuring [GuiRunOnce] to Perform Tasks
Updated: March 28, 2003
Applies To: Windows Server 2003, Windows Server 2003 R2, Windows Server 2003 with SP1, Windows Server 2003 with SP2
The [GuiRunOnce] section of an answer file contains a list of commands, programs, scripts, or batch files that run the first time a user logs on to the computer after the operating system is installed. You can configure [GuiRunOnce] to run multiple commands, programs, scripts, or batch files. The commands, programs, scripts, and batch files run synchronously, which means each command, program, script, or batch file runs to completion before the next one starts running. This lets you control the order in which tasks are performed.
The syntax for [GuiRunOnce] is:
[GuiRunOnce] "command_1""command_2" . . "command_x"
Where command_1, command_2, and command_x refer to the commands, programs, scripts, or batch files that you want to run after the operating system is installed and a user logs on. Note that all commands must be enclosed in quotation marks.
To use [GuiRunOnce], you need to:
Add the [GuiRunOnce] section and the corresponding commands to your answer file.
Copy all of the programs, scripts, and batch files that are listed under [GuiRunOnce] to the $OEM$ folder in your distribution share.
For a worksheet to assist you in recording the commands, programs, scripts, and batch files that you want to run by using [GuiRunOnce], see "Answer File Settings Worksheet" (ACIUI_5.doc) on the Windows Server 2003 Deployment Kit companion CD (or see "Answer File Settings Worksheet" on the Web at http://www.microsoft.com/reskit).
If you use the [GuiRunOnce] section to install software, you need to adhere to the following guidelines:
You cannot run installation programs that require a restart
You can automate installation tasks only if you can prevent the installation program from restarting the computer. When a computer restarts, all remaining entries in the [GuiRunOnce] section are lost. If the system restarts before completing entries listed in the [GuiRunOnce] section, the remaining items will not run. Therefore, you need to suppress restarts. If you cannot suppress a restart within the installation program, you can try to repackage the application into a Windows Installer package. For more information about Windows Installer packaging, see the Windows Installer documentation link on the Web Resources page at http://www.microsoft.com/windows/reskits/webresources.
You cannot run installation programs that rely on the Windows Explorer shell
The Windows Explorer shell is not loaded when the operating system starts running commands, programs, scripts, or batch files that are listed in the [GuiRunOnce] section of an answer file. In some cases, you can get an updated installer program from the application vendor that does not rely on the Windows Explorer shell. If you cannot, you might be able to repackage the application as a Windows Installer package (.msi file).
You might need to run an installation program from a batch file so you can control the installation process with the /wait parameter
Installation programs often start and stop several different processes. In some cases, when you are installing multiple applications, this can inadvertently cause the next installation program listed in the [GuiRunOnce] section to start before the previous installation program is finished running. When this occurs, the second installation program usually fails. To prevent this, you can run the installation programs from batch files by using the start command with the /wait parameter. This forces each installation program to run to completion before the next command listed in [GuiRunOnce] runs. For more information about using the start command to run installation programs in batch files, in Help and Support Center for Windows Server 2003, under Support Tasks, click Tools, click "Command-line reference A-Z", and then click Start.