Excluding USB, FireWire and other drives from USMT Capture

A common requirement during user state migration is to not capture data from certain drives.  The most commonly requested for exclusion are removable drives such as USB and FireWire drives.  There is no command line option to exclude these drives automatically with USMT v3.  I had to turn to scripting to accomplish this.

I created a script, ZTI-ExcludeDrivesXmlGen.wsf (and its function library HelperFunctions.vbs), that will generate a USMT XML rules file to unconditionally exclude USB and FireWire drives (as well as additional specified drives) during the deployment.  The script should be run during the State Capture phase before Scanstate.exe is run.  The resulting XML file should be used on both the Scanstate.exe and Loadstate.exe command lines.  The script is driven by either command line switches or MDT properties:

  • Use the /output switch or the USMTExcludeDrivesOutput property to specify the output XML file.  If not specified, the default of oUtility.LogPath & "\MigExcludeDrives.xml" is used.
  • Use the /usb switch or the property USMTExcludeUsbDrives=True to exclude USB and FireWire drives from the migration.
  • Use the /scriptdrive switch or the property USMTExcludeScriptDrive=True to exclude the drive from which this script is running from the migration.
  • Use the /drives switch or the USMTExcludeDrives property to exclude specific drives from the migration.  The switch should be specified like this example:
        /drives:"D:,E:,F:"
    The property should be specified like this example:
        USMTExcludeDrives=D:,E:,F:
  • Use the /flagfile switch or the USMTExcludeDriveFlagFile property to exclude specific drives from the migration using a flag file.  Using the /flagfile switch without a value or setting USMTExcludeDriveFlagFile=True will cause the script to exclude drives that have the default flag file, NO_USMT_ON_DRIVE.USMT, in the root folder of the drive.  (You SMS experts out there will get the choice of the default flag file name.  J )  Using the switch or property with a file name value will exclude drives that have the specified named flag file in the root folder of the drive.

Remember that the generated XML file must also be used with Loadstate.exe.  Therefore, it must be saved to a location that from which it can be retrieved during the State Restore phase.  I have included a script, ZTI-CopyFilesToStateFolder.wsf, to copy files to a subfolder of the state store location that can be used for this.

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 .

This post was contributed by Michael Murgolo, a Senior Consultant with Microsoft Services - U.S. East Region.

USMTExcludeDrives.zip