Configuration Manager 2012: Select Preferred Deployment from a Prestart Command

 

Over the next few weeks I will be covering some changes introduced into System Center 2012 Configuration Manager 2012.

Configuration Manager 2012 Beta 1 introduces a new feature to select a preferred deployment from a prestart command.  This allows an administrator with a custom front end (i.e. HTA) or script the ability to deploy any task sequence with an active deployment.  It adds the flexibility to automate and selectively run a task sequence when multiple are deployment to a collection.

How it works:   When the media (PXE, bootable or prestaged) boots, the prestart command is run.  This is run prior to the media connecting to the MP for policy.  If the option to run a preferred deployment is set, this task sequence will be used.  The preferred deployment will override any existing available or required task sequences deployed to the system.  It will also act as a required task sequence as it has been specifically specified to run (this is helpful with unattended mode).

How to configure:

Make sure you task sequences have been created, tested and deployed to the environment. 

You will need to retrieve the Advertisement ID for use in your prestart command.  Browse to the Monitoring Wunderbar, select the Deployment – Operating System node.  There is a field Advertisement ID that correlates to this deployment.

In your prestart command, complete any custom logic or selection process to determine the correct deployment to run.  Your prestart command can be any HTA or custom script.  An example maybe that you are deploying a Windows 7 to all clients, but you have a task sequence for notebooks and one for desktops.  You can use a query to WMI and based on the Chassis Type value, based on the value the script picks the appropriate tasks sequence for a desktop or for a notebook.

The prestart command will need to set the task sequence variable SMSTSPreferredAdvertID to the correct Advertisement ID (i.e. CAS00011).  For more information on setting task sequence variables, click here.

After you have created and configured your prestart command, you will need to inject it into your media. You can add these from the properties of a boot image for PXE or media. 

Or fora prestart command that is specific to a bootable and prestaged media, complete the following:

  • Take the files required (scripts and anything related) for the prestart command and create a package in Configuration Manager.  The package does not need to contain a program.  Make sure the package is distributed to at least one distribution point
  • During the Create Task Sequence Media wizard, there is a page Customize.  On this page select Enable prestart command.  Enter a command line to run the prestart command (i.e. script.vbs).
  • Select the option Include files for the prestart command.  Set the package containing the files required and select a distribution point to retrieve the files.  Then complete the wizard as usual.

At this point you now have configured the feature for use.  Enjoy!

Related resources:

Operating System Media Pre-Execution Hook

How to Set an Operating System Deployment Task Sequence Variable

John Vintzel
Microsoft Corporation | Program Manager | System Center Configuration Manager | twitter: jvintzel

These postings are provided "AS IS" with no warranties, and confer no rights.

Updated to remove beta references..

Comments

  • Anonymous
    December 31, 2013
    Pingback from OSD links | sccm road