To create an OS image that will be unique to each deployed machine, you must first execute the Sysprep operation on the OS installation that you plan to image before you capture the image. Sysprep generalizes the image by removing such details as the product key, network settings, and machine SID. Immediately after image deployment, Automated Deployment Services (ADS) reads device variables and replaces the placeholder strings with the device variable values in the sysprep.inf file. ADS then reboots the deployed system into the image, which in turn lets Sysprep customize the system according to the information in sysprep.inf.
You can define the necessary variables for a device (e.g., a target server name) in the Microsoft Management Console (MMC) ADS snap-in or from the command-line (using one of the ADS command-line tools), or you can use an application developed on top of the ADS Windows Management Instrumentation (WMI) component. To use the ADS snap-in, open the device's Properties dialog box and go to the User tab, which Web figure A shows. On this tab, you can add and configure variable names and values.
ADS sequences can then read defined variables' values and use them to replace the placeholder strings in the device's Sysprep file. The sample sysprep.inf file that Listing A shows contains placeholder strings at callout A (for the TimeZone variable) and callout B (for the ComputerName and ProductKey variables). You can use any string as a placeholder, as long as bmstrrep.exe, a parsing tool that the ADS Deployment Agent executes, can distinguish the string. For example, Listing B shows an ADS sequence that personalizes such variables as ^ADS_COMPUTER_NAME^ and ^ADS_WINDOWS_PRODUCT_KEY^ in the sysprep.inf file on a target system. (Note that the placeholder string in the sysprep.inf file is enclosed between two ^ characters. You can replace these characters with any characters you want-for example, #-so long as you can easily identify the placeholder string.) The code at callout A in Listing B executes bmstrrep.exe to parse the file that the code at callout B specifies, replacing the ^ADS_WINDOWS_PRODUCT_KEY^ string with the defined value of the $ProductKey$ variable and so forth. (Note that the dollar sign-$-identifies the ADS device variables in the sequence.)