You can create a prestart command in System Center 2012 Configuration Manager to use with boot media, stand-alone media, and prestaged media. The prestart command is a script or executable that runs before the task sequence is selected and can interact with the user in Windows PE. The prestart command can prompt a user for information and save it in the task sequence environment or query a task sequence variable for information. When the destination computer boots, the command-line is run before the policy is downloaded from the management point. Use the following procedures to create a script to use for the prestart command, distribute the content associated with the prestart command, and configure the prestart command in media.

Create a Script File to Use for the Prestart Command

Task Sequence variables can be read and written by using the Microsoft.SMS.TSEnvironment COM object while the task sequence is running. The following example illustrates a Visual Basic script file that queries the _SMSTSLogPath task sequence variable to get the current log location. The script also sets a custom variable.

  Copy Code
dim osd: set env = CreateObject("Microsoft.SMS.TSEnvironment")
dim logPath
' You can query the environment to get an existing variable.
logPath = env("_SMSTSLogPath")
' You can also set a variable in the OSD environment.
env("MyCustomVariable") = "varname"

Create a Package for the Script File and Distribute the Content

After you create the script or executable for the prestart command, you must create a package source to host the files for the script or executable, create a package for the files (no program required), and then distribute the content to a distribution point.

For more information about creating a package, see How to Create Packages and Programs in Configuration Manager.

For more information about distributing content, see the Distribute Content on Distribution Points section in the Operations and Maintenance for Content Management in Configuration Manager.

Configure the Prestart Command in Media

You can configure a prestart command in the Create Task Sequence Media Wizard for stand-alone media, bootable media, or prestaged media. For more information about the media types, see Planning for Media Operating System Deployments in Configuration Manager. Use the following procedure to create a prestart command in media.

To create a prestart command in media

See Also