People of Earth! It is I, Ned - your benevolent alien dictator - back again to talk to you about USMT.

A few customers have asked me how to prevent XP Classic Start Menu desktop icons from migrating to Windows 7. Since these aren’t true shortcuts, you have to do some gyrations to block these icons from polluting your beautiful pristine new Windows 7 desktop experience.

To give some context, you start with an XP computer. You’ve configured the computer with “Classic Start menu” setting. Icons like “My Documents”, “My Network Places”, and “My Computer”, appear on the desktop because of this configuration:

image

The standard USMT migration, after loadstate without any customization, leaves your Windows 7 desktop looking like the following:

image

Eww. There are more icons than before thanks to the new library code kicking in here.

Note: Don’t confuse this with the XP Classic theme, that’s totally different and I’ve discussed migration options for that here previously. Yeah, looking at you Dave!

So how can you block this default behavior? How can you choose the icons you want to appear on the desktop and ones that you do not?

Blocking all shell desktop icon migration with a hammer

The first part is easy. You block legacy Windows Explorer settings from migrating by:

1. On a test source XP computer, create a new config.xml file with:

Scanstate /genconfig:config.xml

2. Change the Microsoft-Windows-explorer-DL and Microsoft-Windows-shell32-DL values in the config.xml from “yes” to “no”. This prevents the classic shell icons from migrating.

 <component displayname="Microsoft-Windows-explorer-DL" migrate="no" ID="http://www.microsoft.com/migration/1.0/migxmlext/cmi/microsoft-windows-explorer-dl/microsoft-windows-explorer-dl/settings"/>

<

component displayname="Microsoft-Windows-shell32-DL" migrate="no" ID="http://www.microsoft.com/migration/1.0/migxmlext/cmi/microsoft-windows-shell32-dl/microsoft-windows-shell32-dl/settings"/>

3. Add the /config:config.xml argument to Scanstate when you perform your migration. Make sure you can access the config.xml file from the source computer.

This setting prevents USMT from migrating registry settings defined in your explorer-dl.man and shell32-dl.man. If you have some specific pieces of those manifests that you want, then you can copy those include elements into a custom XML file and pass the xml filename with /i argument on your Scanstate command-line. For example, most folks only care about Explorer customizations like “show me the file extensions”. If you only want Folder Options settings, then use this custom XML with the above config.xml:

<migration urlid="http://www.microsoft.com/migration/GetJustUserExplorerTweaks">

 

  <!-- This component migrates just user Explorer settings tweaks like show file extensions-->

  <component type="System" context="User">

    <displayName>GetUserExplorerTweaks</displayName>

    <role role="Settings">

      <rules>

        <include>

          <objectSet>

            <pattern type="Registry">HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\* [*]</pattern>

          </objectSet>

        </include>

      </rules>

    </role>

  </component>

</migration>

Just paste the XML snippet into a file named folderoptionstweaks.xml and pass the filename to Scanstate and Loadstate using the /i argument. Best of both worlds. You can season all this to taste of course.

Putting some of those icons back by creating magical registry entries

The problem with classic menu options is that they are stored as binary data in undocumented registry entries. By blocking the Explorer manifest, we are saying arbitrarily “don’t migrate any of that Explorer goo”. If we want to have a few of those icons appear though, we can’t use some big XP legacy blob. This means we need to create some registry entries on the Windows 7 computer during USMT Loadstate that never existed before.

In the example below, I add the “Documents” and “Computer” icons, as those are the most likely the icons used by your users. Make sure you review my article on using Visual Studio to edit USMT XML files, unless you like suffering.

1. Create a new custom XML called (for example) desktopshellicons.xml and paste in the following elements:

<?xml version="1.0" encoding="UTF-8"?>
<
migration urlid="
http://www.microsoft.com/migration/1.0/NedIconTest">
   <
component context="User" type="Application"
>
    <
displayName>DesktopIconsPurgeMig</displayName
>
    <
role role="Settings"
>
      <
rules
>

        <!--
Emulate the shell values, by creating 2 reg keys and 4 reg values as 0 byte DWORDS
-->
        <
addObjects
>
          <
object
>
            <
location type="Registry">HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel [{59031a47-3f72-44a7-89c5-5595fe6b30ee}]</location
>
            <
attributes>DWORD</attributes
>
            <
bytes>00000000</bytes
>
          </
object
>
          <
object
>
            <
location type="Registry">HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel [{20D04FE0-3AEA-1069-A2D8-08002B30309D}]</location
>
            <
attributes>DWORD</attributes
>
            <
bytes>00000000</bytes
>
          </
object
>
          <
object
>
            <
location type="Registry">HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu [{59031a47-3f72-44a7-89c5-5595fe6b30ee}]</location
>
            <
attributes>DWORD</attributes
>
            <
bytes>00000000</bytes
>
          </
object
>
          <
object
>
            <
location type="Registry">HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu [{20D04FE0-3AEA-1069-A2D8-08002B30309D}]</location
>
            <
attributes>DWORD</attributes
>
            <
bytes>00000000</bytes
>
          </
object
>
        </
addObjects
>

        <!--
Include the emulated registry values so they are actually written in SCANSTATE & LOADSTATE
-->
        <
include
>
          <
objectSet
>
            <
pattern type="Registry">HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel [{59031a47-3f72-44a7-89c5-5595fe6b30ee}]</pattern
>
            <
pattern type="Registry">HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel [{20D04FE0-3AEA-1069-A2D8-08002B30309D}]</pattern
>
            <
pattern type="Registry">HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu [{59031a47-3f72-44a7-89c5-5595fe6b30ee}]</pattern
>
            <
pattern type="Registry">HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu [{20D04FE0-3AEA-1069-A2D8-08002B30309D}]</pattern
>
          </
objectSet
>
        </
include
>
      </
rules
>
    </
role
>
  </
component
>
</
migration>

The <addObject> element injects the registry setting into memory during Scanstate. The <include> tag commits the injected value into the store as a logical registry setting. Then, the Loadstate command creates the registry setting in the registry. Slick.

This injects four registry values needed to enable "Documents" and "Computer" and then saves them during Loadstate. It does not affect actual folders and files, shortcuts, or other data in a user’s Desktop folder.

2. Save this file. Make sure the file exists on both source and destination computers.

3. Run Scanstate and Loadstate passing the filename with /i: argument (/i:desktopshellicons.xml). Also include the config.xml modified earlier in this article.

Wrapup

Hopefully you’ve learned a few useful things here:

  1. Understand what a config.xml manifest really does and which manifest to examine.
  2. Learn how to deal with XP’s legacy shell cruft during migration to Windows 7.
  3. Learn how to create new registry values as part of a migration when they did not exist on the old source computer.
  4. How I crash landed in Roswell in ’47.

Until next time,

Ned “image” Pyle