Windows DevCenter    
 Published on Windows DevCenter (
 See this if you're having trouble printing code examples

Using Folder Redirection

by Mitch Tulloch

Many Windows applications save their work in My Documents or one of its subfolders such as My Pictures or My Music. For home users this is fine, but in a business environment it's not a good idea to store users' work on their local machine. The main reason is that typically only servers are backed up, not desktop computers. So if a user's machine crashes, his work will be gone if it was stored on his machine rather than on the network. The solution is to use folder redirection, and that's what we'll look at in this article.

The easiest way to configure folder redirection is to use Group Policy in an Active Directory environment. Let's say the Boston branch office for our company has two groups of users (Sales and Support) that need to save their documents on a network server instead of their local machines. The Jones sisters, Mary and Sally, belong to the Sales group, while the Smith brothers, Al and Bob, belong to Support. Let's say further that we want to redirect the work for each group of users to a different share on file server Test220. Specifically, members of the Sales group will save their work in \\Test220\SalesDocs, while members of Support will save theirs in \\Test220\SupportDocs. Finally, let's assume these users and groups are all located in the Boston organizational unit in our Active Directory domain. That way we can use a Group Policy Object (GPO) linked to the Boston organizational unit to configure folder redirection for these groups.

Here's what the Boston GPO settings for folder redirection look like:

Figure 1
Figure 1. Group Policy Object settings for folder redirection.

As you can see, there are four folders you can redirect:

These four folders are also part of the user's profile and are located as follows:

%UserProfile%\Application Data
%UserProfile%\My Documents
%UserProfile%\Start Menu

where %UserProfile% is an environment variable indicating where the user's profile is stored. For example, the local user profile for user Mary Jones would be stored in C:\Documents and Settings\mjones on her desktop computer.

Which of these four folders should you redirect? Usually only My Documents, since that's where the user's work is saved, but if users tend to copy or move files or folders to their desktop for easy access, you may want to redirect the Desktop folder as well. Redirecting the Application Data folder is generally not a good idea; some applications need their state information to be stored locally or problems occur like disappearing toolbars. And redirecting the Start Menu is generally not recommended, as there are other ways to control what appears on the Start menu using Group Policy.

So let's focus on redirecting only the My Documents folder to our network server. Right-click on My Documents in the right-hand pane above and select Properties, then choose Advanced so we can designate different target locations for different groups:

Figure 2
Figure 2. Configuring folder redirection for My Documents.

Click on Add and select the Sales group. Leave the target location as "Create a folder for each user under the root path," and specify the UNC path to the SalesDocs share:

Figure 3
Figure 3. Members of Sales will have My Documents redirected to the SalesDocs share on Test220.

Click on OK and repeat the process to redirect My Documents for members of Support to the SupportDocs share. Your folder redirection settings for My Documents now look like this:

Figure 4
Figure 4. Folder redirection settings for My Documents for different groups.

Now switch to the Settings tab to view details of how redirection will occur:

Figure 5
Figure 5. Additional redirection settings for My Documents.

Note that each user will have exclusive rights to his redirected folder. Also, any files currently stored in My Documents on his desktop computer will be copied to the network share. (This will happen the next time the user logs off.) Wait for Group Policy to refresh (or use gpupdate /force to force a refresh), and the folder redirection settings are applied to the user's profile.

Testing Folder Redirection

Let's say Bob had a document named Help Desk Procedures stored in his local My Documents folder on his desktop computer. Once the above folder redirection settings are configured and Bob logs on and then off, the following folders are created in the SupportDocs share on Test220:
\SupportDocs\bsmith\My Documents
\SupportDocs\bsmith\My Documents\My Music
\SupportDocs\bsmith\My Documents\My Pictures

When Bob opens the My Documents folder on his local machine, the Help Desk Procedures document and the subfolders have special icons indicating that offline files are configured for these items:

Figure 6
Figure 6. Items within My Documents are configured as offline files.

Opening the Properties sheet for My Documents lets Bob verify that his work is being saved on the file server:

Figure 7
Figure 7. Target location for My Documents for Bob Smith.

When Bob opens the document, edits it, and saves changes, those changes are immediately saved to the copy of the file stored in the \SupportDocs\bsmith\My Documents folder. So if Bob's machine suddenly crashed after he saved his document, the document would be safe. If his redirected My Documents folder contains very large files, it may take longer to open them, as they must be retrieved from the network before they can be opened locally. When he logs off his machine, a Synchronizing dialog box appears briefly, indicating that offline files are being synchronized as necessary.

If he becomes disconnected from the network while doing his work, a computer icon will appear in the status bar at the bottom right of the screen with a tool tip indicating that he is offline:

Figure 8
Figure 8. Synchronization cannot occur when the network is not available.

Double-clicking on this computer icon brings up more details:

Figure 9
Figure 9. Status of offline files waiting to be synchronized.

Clicking on the Settings button lets you change how files are synchronized:

Figure 10
Figure 10. Configuring synchronization settings.

If network connectivity is restored while Bob is logged on, synchronization will occur when he logs off.

Final Tip

Using folder redirection in conjunction with offline files and disk quotas is a great way to keep users' documents centralized on a file server that can be backed up easily. But folder redirection has its uses on home machines too, even if you don't have a network. If your computer has two hard disk partitions (say, C: and D:), you can redirect My Documents to the D: drive, so all your work files will be stored on that volume. Just right-click on your My Documents folder and configure the target location accordingly. Then if your system becomes unstable for some reason, you can wipe your C: partition (your system partition) and reinstall Windows on it without overwriting your work files on the D: partition.

Mitch Tulloch is the author of Windows 2000 Administration in a Nutshell, Windows Server 2003 in a Nutshell, and Windows Server Hacks.

Return to

Copyright © 2009 O'Reilly Media, Inc.