Redirect ‘My Documents’ without a domain

In business networks it can be very beneficial to setup centralized document storage so that all users can easily store their data on a file server. If you manage Windows computers that are part of a Windows Domain you may know that you can use Group Policy to redirect your user’s “My Documents” folder to a file server, but what if your site doesn’t have a Windows Domain? Perhaps they prefer to use Linux or Mac OS X for servers instead. Who can blame them, but In such environments they can’t use Group Policy to push configuration changes to Windows clients.

I recently encountered this situation but I wanted to get the benefit of centralized document storage so came up with a script to solve the problem. The script makes a few simple registry changes to set the location where you’d like to store the documents and will copy the users documents for you.

The script can be downloaded from http://epiphia.com/files/mydocs-network-redirect.bat.zip

To use the script, edit the altMyDocsPath variable in line 8 to set the path you wish to redirect to.  For example if users have a home drive of h:\ and you’d like to redirect their document there, you could use:

set altMyDocsPath=h:\Documents


You can also use a UNC path, i.e. \\server\path, and may use a variable to represent the username, for example,

set altMyDocsPath=\\FileServer\Users\%USERNAME%\Documents

How it Works

The script will copy the users files from their “My Documents” to the path you set above. Then it will change the registry keys necessary to set the new path to their documents.  The two registry keys being changed are:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Personal
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Personal 


In the above paths the “personal” keys set the path to the “My Documents” folder.  Before it makes changes a backup of these keys is saved to c:\.  If you need to restore the backup just find the two .reg files and double-click them to import into the registry.

After the script runs the user must log out and log back in for the change to take effect.

Deploying Over the Network

My prefered way to push out the changes is to place the script on a server and call it from a logon script. You could send it out in an email and instruct users to run it, or put it somewhere on the network and have them run it.

Only Runs Once

The script is designed to check whether it has already been run so that you can use it in a logon script indefinitely. This allows you to leave it in place for a period of time until all your users pick up the changes.

  • Trackback are closed
  • Comments (0)
  1. No comments yet.