Running the Install
To test the image with the scripts, reboot your system after running SYSPREP –PNP. If everything runs correctly, Windows 2000 will run the mini setup wizard on the first boot. The system will run plug-and-play detection to install and configure hardware devices. At the end of the setup wizard, the system will reboot. When the machine comes back up, Windows 2000 will automatically log in as the administrator.
At this point, the FIRSTBOOT.CMD file is executed, as configured in the SYSPREP.INF [GuiRunOnce] entry. FIRSTBOOT.CMD imports RUNAGAIN.REG and FIXSHELL.REG into the Windows registry. In addition, it deletes a remnant file from the SYSPREP process, C:\WINNT\SYSTEM32\$WINNT$.INF.
RUNAGAIN.REG configures the system so that it will execute NETSETUP.CMD from the RunOnce key in HKEY_CURRENT_USER. When RUNAGAIN.REG is imported into the registry, the Windows 2000 startup process has not yet read this key. As Windows 2000 continues to boot, it will read the new entry in the key and execute NETSETUP.CMD. When the registry key is read and NETSETUP.CMD is executed, the RunOnce key will be automatically blanked.
When NETSETUP.CMD runs, it first checks for the existence of SYSNAME.INF. If SYSNAME.INF exists, that means that NETSETUP.CMD has already executed the first time. Because SYSNAME.INF does not exist on this run, COMPNAME.VBS is executed. COMPNAME.VBS will generate the SYSNAME.INF file. Immediately after running COMPNAME.VBS, NETSETUP.CMD will run NETSET.EXE using the new SYSNAME.INF file to assign the new name to the system. Next, RUNAGAIN2.REG is imported into the Windows registry, and the system reboots using SHUTDOWN.EXE.
RUNAGAIN2.REG configures the system so that it will execute NETSETUP.CMD from the RunOnce key the next time the system boots. I know that it looks like you could just import RUNAGAIN.REG and do away with one of the files, but I noticed reliability problems if I didn’t give the commands different names in the registry. We do the system rename and domain join in two separate boot cycles because the system must be rebooted after renaming it, or the domain join will not work.
After the system comes up, it again automatically logs on as the administrator. NETSETUP.CMD executes from the RunOnce key. This time, the SYSNAME.INF file exists, so NETSETUP.CMD runs the commands in the :GOTNAME section. The system pauses for 45 seconds to allow device drivers to load completely. After waiting for the device drivers to load, the system configures the network options and joins the domain by running the JOINDOM.INF file through NETSET.EXE. After completing the network reconfiguration, unnecessary files are deleted from the C:\WINNT\TEMP directory, and SHUTDOWN.EXE is called to reboot the system.
After the next reboot, the system should be properly named, joined to the domain, and ready for domain users to log on.
In the next part of this series, we'll look at delivering the image to the target workstations using a bootable image on a CDR.