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.
Comments
Anonymous
January 01, 2003
Hey, This is great, thanks so much for this wonderful automagicall way of authoring XML for usmt.Anonymous
January 01, 2003
I was investigated about usmt 4.0 to do a better refresh, and i find some blog interested about: FrankAnonymous
January 01, 2003
Where i should place these scripts as i want to avoid processing the data present in d or e drive which is taking so much time i need to migrate 100 xp system where users having much data in other than os drive so i want to exclude those drive pls help to provide the location for those script to exclude pls treat me as a new comer in MDT pls helpAnonymous
January 01, 2003
can someone help me to guide me for including the script in MDT 2010 i am new in MDT pls help me with detailed steps which i should make changes to exclude drivesAnonymous
January 01, 2003
Did you include the resulting XML file on either the USMT scanstate and loadstate command lines (/i:"%LogPath%MigRootFolders.xml") or using the USMTMigFiles MDT property to specify this as a USMT XML file to use? Michaal MurgoloAnonymous
April 12, 2011
I put all the script in the MDT server in the deployment share -> scripts folder Then edited the cs.ini as below [Settings] Priority=Default Properties=MyCustomProperty, USMTExcludeDrivesOutput, USMTExcludeUsbDrives, USMTExcludeScriptDrive, USMTExcludeDrives, USMTExcludeDriveFlagFile [Default] OSInstall=Y USMTExcludeDrivesOutput=outtest.xml USMTExcludeUsbDrives=True USMTExcludeScriptDrive=True USMTExcludeDrives=D:,E:,F: USMTExcludeDriveFlagFile=True USMTExcludeDriveFlagFile=offline.flg SkipAppsOnUpgrade=YES SkipCapture=NO SkipAdminPassword=YES SkipProductKey=YES PLS NOTE I HAVE NOT EDITED ANY OTHER SCRIPT THEN I TESTED THE INSTALLATION BUT IT DID NOT EXCLUDE THE DRIVES PLS HELPAnonymous
February 20, 2014
Great script. I used it in an offline usmt scenario with USMT 5. I tried to keep things simple, so my steps to implement it were to: (1) copy the scripts into the MDT scripts folder (2) add a cscript command referencing the script before both the offline usmt section and the restore (I was just excluding the scriptdrive): cscript //nologo "%SCRIPTROOT%ZTI-ExcludeDrivesXmlGen.wsf" /scriptdrive (3) add the following parameter for the scanstateargs variable in customsettings.ini: /i:"%LogPath%MigExcludeDrives.xml" (4) add the following parameter for the loadstateargs variable in customsettings: /i:"C:MININTSMSOSDOSDLOGSMigExcludeDrives.xml"Anonymous
January 23, 2015
Good morning, I got a bit confused on how using this solution on my environment. I have a SCCM 2012 R2 integrated with MDT 2013.
I will be using my CustomSettings.ini to apply those settings, but I am not sure if I should place all the files from the Folder (USMTExcludeDrives) on my MDT server in the deployment share -> scripts folder or if I should use my SCCM TS to call those wsf files somehow. It's not very clear for me.
Thanks for the help in advance.
Eden Oliveira