sccm.haas.se
30Jan/124

How to migrate only one specific folder with USMT.

I really had to scratch my head to solve this task. Maybe there’s an easier way to do this but this is how I solved a problem with a customer that only wanted to migrate one specific folder with USMT. All their users save all their personal data on their C-drive in a folder with a common name. I’ll call the local folder “Personal Data” in this blog post.

USMT is not good at opting in specific folders only. It’s more built to migrate everything plus that extra folder you need and then opt out some folders or filetypes that shouldn’t be included. But how do you exclude the C-Drive and at the same time include only one folder from the same drive?

Simply exclude C:\ and Include the “Personal Data”-folder and use the parameter to disregard all profiles. USMT can handle an Inclusion that is part of an Exclusion as long as the folders are in different components in the XML-file. See below. (Look at this article on Technet for more info on how USMT handles conflicts and precedence.)

That almost works.

It turns out USMT has some very quirky behavour. It did migrate my “Personal Data” folder but it also migrated all my *.wav default sounds in the Windows folder, some fax-coversheets and even some *.dll files that definitely wasn’t specified by me to be included. So, the solution was to exclude three folders that USMT tried to migrate anyway. The folders that were included by USMT contrary to my settings where these: C:\Program Files,  C:\Windows and C:\ProgramData.

So here’s what the final XML-file looks like that I use to migrate only one folder.

<migration urlid=http://www.microsoft.com/migration/1.0/migxmlext/PersonalFiles>
<component type="Documents" context="System">
  <displayName>Exclude entire C drive</displayName>
  <role role="Data">
    <rules>
      <exclude>
           <objectSet>
     <pattern type="File">c:\* [*]</pattern>
           </objectSet>
      </exclude>
    </rules>
  </role>
</component>
<component type="Documents" context="System">
  <displayName>Migrate Personal Folder</displayName>
  <role role="Data">
    <rules>
      <include>
        <objectSet>
          <pattern type="File">C:\PersonalData\* [*]</pattern>
        </objectSet>
      </include>
    </rules>
  </role>
</component>
   <component type="Documents" context="System">
      <displayName>Test</displayName>
      <role role="Data">
         <rules>
             <unconditionalExclude>
               <objectSet>
                  <pattern type="File">C:\Program Files\* [*]</pattern>
                  <pattern type="File">C:\Windows\* [*]</pattern>
                  <pattern type="File">C:\ProgramData\* [*]</pattern>
               </objectSet>
            </unconditionalExclude>
         </rules>
      </role>
   </component>
</migration>

I also use the following Scanstate-syntax to exclude the local and roaming user profiles and to include my custom XML-file. Note that I don’t include any other XML-files.

scanstate.exe /listfiles:c:\windows\temp\listfiles.txt /i:c:\USMT\PersonalFiles.xml /ue:*\*

Parameters explained:
/i = Config-file to include
/ue:*\* = Exclude all local and domain users.
The commandline switch /listfiles lists all files that are migrated with USMT to a logfile which is great for troubleshooting.

 If you found this useful, please leave a comment to make me happy!

Thanks,
Mathias.

Tagged as: , Leave a comment