Redirect known folders to OneDrive for Business

You can redirect Windows known folders (such as Documents) to the OneDrive for Business sync location for the users in your domain.

There are two primary advantages to doing this:

  • Your users can continue using their Documents and other similar folders. They don't have to change their daily work habits in order to use OneDrive for Business.

  • Using OneDrive for Business for your documents gives you a backup of your data in the cloud and gives you access to your documents from any device.

For these reasons, we recommend setting up folder redirection if you're an enterprise or large organization. Small or medium businesses may also find this useful, but keep in mind you'll need some experience in Windows Server group policy and data migration to follow the procedures below.

How it works

Here's an overview of what we'll be configuring in this article:

  1. We'll set a group policy at the domain level to make sure users all sync to the same folder when they install the OneDrive for Business sync client.

  2. We'll set additional group policies to redirect the Documents folder to that sync location.

When a user logs in to their computer, group policy will detect if the OneDrive for Business sync folder exists in the specified location. If the sync folder does not exist (for example, if the user hasn't set up the sync client yet or if this is the first time they've logged in to the computer), the Documents folder will not be redirected. If the sync folder does exist, the Documents folder will be redirected to the OneDrive for Business sync folder.

Once the Documents folder has been redirected, shortcuts to Documents - such as those in Windows Explorer - will point to the new location. However, the original folder and its contents will remain at its previous location under %userprofile%\Documents. You can then migrate any files from the original folder to OneDrive for Business, and delete the original folder if desired.

Before you begin

There are a number of things to consider in determining if redirecting known folders to OneDrive for Business is a good solution for your organization:

  • OneDrive for Business has some restrictions around file naming, file size, and file type, that you should review before deploying OneDrive for Business. Keep in mind that your users may try to use files of these types with OneDrive for Business, or the OneDrive for Business sync client may try to synchronize them when you redirect users' Documents folders.

  • If your users have used the Documents folder as an installation location for some legacy applications, the applications may no longer work after the folder has been redirected. If your organization uses legacy applications that were not written to support folder redirection, be sure to test them before redirecting folders to OneDrive for Business.

  • If your users' Documents folders contain items with a very high frequency of updates - such as databases, web servers, or Outlook OST files - we recommend not redirecting these folders to the OneDrive for Business sync location. While such files should continue to function normally, the high frequency of sync activity due to constantly changing files may cause network and performance issues.

If you are already redirecting known folders to a different location - for example, a network share - or if you have already deployed OneDrive for Business, then there are some additional planning considerations:

  • If you are currently redirecting known folders to a network share or other location, you will need to migrate that data to the new OneDrive for Business location after you redirect the known folders to OneDrive for Business.

  • Once known folders have been redirected to OneDrive for Business using the procedures in this article, previously existing files in the user's known folders will remain on their hard disk and need to be manually migrated to the user's OneDrive for Business sync folder. We suggest using XCopy or Robocopy scripting as an automated way of moving the files for your users.

  • In order to redirect known folders to OneDrive for Business, users must be syncing their OneDrive for Business files to the default sync directory (%userprofile%\OneDrive - <TenantName>). Redirecting known folders to different OneDrive for Business sync locations is not supported.

  • If your users have a large volume of content that will be added to OneDrive for Business, you may want to stage your deployment to limit the impact on your network.

Prerequisites and baseline environment

The procedures in this article require a particular existing configuration to exist in order to work. Check these prerequisites before you get started:

  • Be sure that you have installed the OneDrive for Business group policy objects on your domain, and updated the ADMX file with your tenant ID.

  • Be sure any existing OneDrive for Business users in your organization are syncing their files to the default sync location (%userprofile%\OneDrive - <TenantName>). Users who are syncing files to a different location will not have their known folders redirected to OneDrive for Business.

  • All of the procedures in this article are performed in your domain group policy editor. You need to be a domain administrator to perform these procedures.

Redirecting known folders to OneDrive for Business

The first step in redirecting known folders to OneDrive for Business is to make sure users sync their OneDrive for Business to the default location when they set up the sync client. We do this through a domain group policy.

To prevent users from changing the location of their OneDrive for Business sync folder
  1. In your domain group policy editor, under User Configuration\Policies\Administrative Templates\OneDrive, double-click Prevent users from changing the location of their OneDrive folder.

  2. Select the Enabled option, and then click OK.

The next step is to create an environment variable for the OneDrive for Business sync folder. Group policy won't let us redirect known folders directly to a different location under %userprofile%, so we need to create a new environment variable that contains the location of the sync folder under %userprofile%.

We'll use item-level targeting in this environment variable to prevent folders from being redirected until the sync folder has been created by the sync client.

To create an environment variable for the OneDrive for Business sync folder
  1. In your domain group policy editor, under User Configuration\Preferences\Windows Settings, right-click Environment, click New, and then click Environment Variable.

  2. In the Name box, type OneDriveSync.

  3. In the Value box, type %userprofile%\<SyncFolder>.

    <SyncFolder> is the name of your default sync folder. For example, OneDrive - Contoso   .

  4. On the Common tab, select the Item-level targeting check box, and then click Targeting.

  5. In the Targeting Editor, click New Item, and then click File Match.

  6. Choose Folder exists from the Match type drop down list.

  7. In the Path box, type %userprofile%\<SyncFolder> (the same path that you used in step 3).

  8. Click OK.

  9. Click OK.

Now it's time to configure the known folders redirection itself.

Note that we do not support having existing content automatically migrated by group policy to the sync folder. (See the warning in the procedure below). With automatic file migration, there is a potential for data loss in cases where there are files in both locations that have matching filenames.

To redirect Documents folders to the OneDrive for Business sync folder
  1. In your domain group policy editor, under User Configuration\Policies\Windows Settings\Folder Redirection, right-click Documents and click Properties.

  2. From the Settings drop down list, choose Basic - Redirect everyone's folder to the same location.

  3. Under Target folder location, choose Redirect to the following location.

  4. In the Root Path box, type %OneDriveSync%\Documents.

  5. On the Settings tab, clear the Move the contents of Documents to the new location check box.

    Warning: Leaving this setting enabled could result in data loss when the contents of the Documents folder is merged with the OneDrive for Business sync folder, if there are files with the same name in both locations.

  6. Click OK.

We've now set the Documents folder to redirect to the OneDrive for Business sync location. You can also easily redirect related known folders - Picture, Music, or Videos - by having them follow the redirection of the Documents folder. If you want to do this, use the following procedure.

To redirect related folders to the OneDrive for Business sync folder
  1. In your domain group policy editor, under User Configuration\Policies\Windows Settings\Folder Redirection, right-click the related folder that you want to redirect - Pictures, Music, or Videos - and click Properties.

  2. In the Setting drop down list, choose Follow the Documents folder.

  3. Click OK.

Now that folder redirect has been configured, users' known folders will be redirected to their OneDrive for Business sync folder once their OneDrive for Business sync client has been set up. Once the redirect is in place, you'll need to migrate the user's data from the original location on their local disk to the OneDrive for Business sync folder.

Keep in mind that as new users and computers come online over time, users may still save files to their Documents folder before they configure the OneDrive for Business sync client, and these files would then need to be migrated to the OneDrive for Business sync folder after the redirect takes place.

See Also

Robocopy

Share Facebook Facebook Twitter Twitter Email Email

Was this information helpful?

Great! Any other feedback?

How can we improve it?

Thank you for your feedback!

×