Share via


USMT 4.0 Custom Sample - Blocking Shortcuts During Migration

Scenario

You want to exclude shortcuts (LNK and LNK2) files from migrating for users with USMT 4.0, for whatever reason. By default USMT always tries to copy shortcuts for files that exist on the destination computer during loadstate, as most users would want that data.

Sample for each user's Desktop folder

<?xml version="1.0" encoding="UTF-8"?>
 <!--Sample - excludes shortcuts on the user desktop from migration; has nothing to do with shell icons like "my documents"-->
  <migration urlid="http://www.microsoft.com/migration/1.0/migxmlext/desktoplnkexclusions">
   <component type="Documents" context="User">
    <displayName>Exclude User Desktop Shortcuts</displayName>
    <role role="Data">
    <rules>
     <unconditionalExclude>
     <objectSet>
      <pattern type="File">%CSIDL_DESKTOP%\ [*.lnk]</pattern>
      <pattern type="File">%CSIDL_DESKTOP%\ [*.lnk2]</pattern>
     </objectSet>
     </unconditionalExclude>
    </rules>
   </role>
  </component>
</migration>

Further Notes

  • Arbitrarily blocking the shortcuts from migrating is not a recommended operation, as many users cannot distinguish between files and their shortcuts, leading to a perceived "deletion."

  • To specify other user profile paths, see:

Recognized Environment Variables  

  • USMT custom samples are always provided AS-IS and are not supported by Microsoft except through "best efffort."