USMT and /SF

Hi all, Ned here again. I’ve seen an emerging issue with USMT that I need to address while our TechNet documentation is updated. If you are using USMT 4.0 for migrations from XP, this is required reading to avoid some very gnarly problems when using the /SF switch in loadstate. Onward.

Background

When reading our TechNet USMT documentation, you may find occasional examples that have the loadstate.exe using a switch called /SF. If you look at the USMT command-line documentation though, there is no mention of this switch at all. And in the great majority of our examples, the switch is never used. Running loadstate.exe /? shows:

/sf Restores shell folder redirection

What the what?

Shell folder redirection is an option within Windows Explorer to change the default locations of the built-in shell folders, such as My Documents. It’s typically configured through Folder Redirection group policy. In the grand scheme of hundreds of millions of business computers though, it’s strictly in the minority and rarely used compared to the defaults – especially in an unmanaged fashion; it’s not easy for the typical end user to find.

The USMT /SF option was designed to migrate the shell folder settings. Unfortunately, when loadstate runs it incorrectly updates the global registry path:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders

This happens with both online and offline migrations.

Symptoms

If you use the /SF switch to migrate from an XP computer to Windows 7 or Vista, you see the following issues:

  • Attempting to open the Administrative Tools folder returns error:

"Location is not available
C:\Users\Public\Start Menu\Programs\Administrative Tools refers to a location that is unavailable. If could be on a hard drive on this computer, or on a network. Check to make sure the disk is properly inserted, or that you are connected to the Internet or your network, and then try again. If it still cannot be located, the information might have been moved to a different location."

image

  • The “search programs and files” box does not allow you search for any files. For example, when typing in “regedit” it returns error:

“search:query=regedit
Windows cannot find ‘search:query=regedit’. Make sure you typed the name correctly, and then try again.”

image

  • The “All Programs” menu only shows "Internet Explorer", "Accessories", "Maintenance", and "Startup".

image

There may be more, these are just the ones that I have been able to find or reproduce from customer feedback. Use that Comments section!

Workaround

There are a few ways to resolve these issues:

1. If you are not using redirected folders in Windows XP source computers, stop using the /SF switch on loadstate.

2. If you want to use /SF or are unsure if redirected shell folders are being configured on clients, you can add the following sample batch file to your steps. After running loadstate.exe, you would then run these in a CMD batch file:

REM This sample script is provided "AS IS" with no warranties, and confers no rights.REM For more information please visitREM https://www.microsoft.com/info/cpyright.mspx to find terms of use.REM Copyright 2010 Microsoft Corporation REM Simple batch script to fix up user shell folder registry values REM The empty SET commands are necessary to prevent the environment variables from being expanded by CMD and REGREM Note also that the variables are being escaped with double % marks - this is necessary when run in a CMD file REM This script code should be added to the end of the loadstate batch file being run during offline migration SET PUBLIC=SET ProgramData= reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /t REG_EXPAND_SZ /v "Common Desktop" /d "%%PUBLIC%%\Desktop" /freg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /t REG_EXPAND_SZ /v "Common Documents" /d "%%PUBLIC%%\Documents" /freg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /t REG_EXPAND_SZ /v "CommonPictures" /d "%%PUBLIC%%\Pictures" /freg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /t REG_EXPAND_SZ /v "CommonMusic" /d "%%PUBLIC%%\Music" /freg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /t REG_EXPAND_SZ /v "CommonVideo" /d "%%PUBLIC%%\Videos" /freg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /t REG_EXPAND_SZ /v "{3D644C9B-1FB8-4f30-9B45-F670235F79C0}" /d "%%PUBLIC%%\Downloads" /freg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /t REG_EXPAND_SZ /v "Common Start Menu" /d "%%ProgramData%%\Microsoft\Windows\Start Menu" /freg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /t REG_EXPAND_SZ /v "Common Programs" /d "%%ProgramData%%\Microsoft\Windows\Start Menu\Programs" /freg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /t REG_EXPAND_SZ /v "Common Startup" /d "%%ProgramData%%\Microsoft\Windows\Start Menu\Programs\Startup" /freg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /t REG_EXPAND_SZ /v "Common AppData" /d "%%ProgramData%%" /freg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /t REG_EXPAND_SZ /v "Common Templates" /d "%%ProgramData%%\Microsoft\Windows\Templates" /f

I’ve attached this as a TXT file as well, since the formatting here is not pretty.

And that’s that. Please don’t ask about a bug fix or ETA on TechNet being updated, I’ve got nothing for you yet. This article is designed to get you out of the woods.

- Ned “documenting the undocumentable” Pyle

fixusf.txt