Customizing USMT Estimation with ConfigMgr Task Sequence

One of the advantages of integrating MDT 2008 with ConfigMgr 2007 is a more dynamic state capture process.  The MDT task "Determine Local or Remote" (ZTIUserState.wsf) gives you the ability to estimate the amount of space required for the state store, and then determine whether to store it on the local hard drive or across the network on the ConfigMgr state migration point (SMP) role.  One of the nice features of USMT is the ability to customize the capture through command line parameters and custom XML rule files.  So how do you combine all of this into a single, custom, dynamic task sequence?

Let's say you have three custom XML files: CustomMigUser.xml, CustomMigApp.xml and Custom.xml (you're targets are Windows Vista so you're not using MigSys.xml), and you want to define the following USMT command line exclusions: /uel:60 /ue:contoso\~admin* /ue:* (exclude profiles older than 60 days, exclude all CONTOSO domain users that start with "~admin" and exclude all local users).

First, the requirements:

  • ConfigMgr 2007 with MDT 2008 integrated, and at least the MP, DP and SMP roles defined
  • A ConfigMgr software distribution package for the Microsoft Deployment Toolkit
  • A ConfigMgr software distribution package for the MDT Settings
  • A ConfigMgr software distirbution package for USMT

I find it easiest to create the packages by creating a task sequence from one of the MDT templates.  The MDT wizard then walks you through the process.

Next let's look at the tasks:

  • Gather: an MDT task that's needed to reference CustomSettings.ini in your MDT settings package. More to come later on this.
  • Set USMT Parameters: use ConfigMgr's built-in "Set TS Variable" task to set the value of the OSDMigrateAdditionalCaptureOptions variable to your USMT command line additions, "/uel:60 /ue:contoso\~admin* /ue:*" (sans quotation marks).  This will be appended to the ScanState command line when ConfigMgr performs the capture.
  • Determine Local or Remote: the MDT task for ZTIUserState.wsf.  Nothing to customize here other than specifying your ConfigMgr package for USMT.  It's important to note that this script sets the USMTLocal variable which is used later.
  • Request State Store: the ConfigMgr task to request access and reserve space on a SMP.  A condition must be set here to check the TS Variable USMTLocal not equals "True."  In other words, if the previous estimate finds enough local space, it sets the variable to true, and this task is skipped.
  • Capture User State: ConfigMgr's built-in task to run ScanState from your USMT package.  Make sure to customize the task ("Customize how user profiles are captured") and identify your three custom XML files.  If ZTIUserState goes local, the state store is saved locally, otherwise the previous step requested space on the SMP which is used here.
  • Release State Store: the companion ConfigMgr task to the previous SMP request, this needs the same condition on the USMTLocal TS variable.

After the OS deployment and configuration, use the Request State Store (with the USMTLocal condition), Restore User State (customized with your three XML files), and Release State Store (with the USMTLocal condition) tasks in a similar fashion.  They'll automatically know to pull the state store from local storage or the SMP.

All done?  Not yet.  Using the OSDMigrateAdditionalCaptureOptions variable and custom XML files in the above tasks only apply to the ConfigMgr tasks that call USMT.  The ZTIUserState script also calls ScanState from your USMT package, but by default doesn't know about your custom XML files and additional command line parameters.  So with no other changes, you could potentially grossly overestimate the space required for your state store, and unnecessarily cause the state capture to use precious network bandwidth and time by going to the SMP when it could have used local storage.  Especially if you're using command line parameters to exclude certain profiles which can significantly alter the size of the state store.

So how do we make ZTIUserState understand our customizations?  Remember above we are using the MDT Gather task to define CustomSettings.ini in the MDT settings package.  So now we need to add the following lines to CustomSettings.ini so that they match the customizations used by the ConfigMgr tasks:

USMTMigFiles1=CustomMigUser.xml
USMTMigFiles2=CustomMigApp.xml
USMTMigFiles3=Custom.xml
ScanStateArgs=/uel:60 /ue:contoso\~admin* /ue:*

ZTIUserState uses these to add the customizations to the ScanState command line so that its estimation aligns with the actual capture.

I can't claim all of the above as my own - one of the MDT templates creates some those tasks with the proper conditions.  Also I remember reading about some of the CS.ini inclusions for a better estimate, but now I can't find the source.  If anyone knows who might have written about something similar, please let me know so I can give proper credit (e-mail or comment on this post).

Disclaimer: The information on this site is provided "AS IS" with no warranties, confers no rights, and is not supported by the authors or Microsoft Corporation. Use of included script samples are subject to the terms specified in the Terms of Use .