Active Directory Home Folder Moves

Posted on 2014-08-17
Last Modified: 2014-08-29
I’ve just started to work for a school district where I would like to change the way that their Documents folders are being mapped. In the current structure they are using group policy to map the documents folder using the “Advanced - Specify locations for various user groups” and creating the users Documents folder biased upon their building using security permissions (There are 10 buildings in all)

The way I have always setup AD home folders is by using the Profile tab under the user account in AD and then mapping their documents folder based upon this location using this home folder location.

The current file structure is a follows (By Building)

- Students (root)
      - Building 1
      - Building 2
      - Building 3
      - Building ….

The way I would like it setup. (By graduating year)

- Students (root)

AD users and computers current has the user accounts separated by building OUs and Sub OUs of graduating school year. (I think this is a good thing and we will keep it this way)

Building 1

Building 2

What I need is a way to move their current home holders using Robocopy and setup some parameters using their OU membership.  I don’t mind doing this for each individual building but if I have to do each student manually it will take way too long.

The script needs to be something like this

If OU = buildingA and SUB OU = 2015
      move from d:\students\Building A\%username%\My Documents  d:\students\2015\%username%\Documents

Yes I want to also change the “My Documents” folder to “Documents”
Question by:Scott Halford
    LVL 34

    Expert Comment

    In reality Home Directory is different from Redirected folders, home directories are different from redirected folders

    Home directory can be set as below
    \\server1\userdata\%username% where user get exclusive access to home directory

    You can either move the directory first with robocopy or something else that will preserve permissions, or you can let the Folder Redirection Policy do the moving.

    The best way I can see is to use robocopy command to copy all data to new location, share data as appropriate and then change path to new location
    Check below articles
    To set new folder redirection after you copy data with robocopy
    Robocopy syntax for data copy
    robocopy \\server1\users\ \\server2\users /MIR /ZB /e /Copyall /sec /secfix The above command will copy data with same permissions and same directory struccture
    Make sure the setting "Move the contents of My Documents to the new location" is unchecked well in advance if you want to use Robocopy to copy files \ folders

    The another option is straight:
    Folder redirection policy will take care of data movement
    Check below excellent articles


    Author Comment

    by:Scott Halford
    I think I may not have been as clear as I should have in my first post. I want to change the file structure.  Currently the "Document" structure on the file server is as follows.

    Current structure
    Students (root folder)
     - Building 1 - (This is a subfolder of "Students that contains multiple graduating years. 2017,2016,2015)
     - Building 2 - (This is a subfolder of "Students that contains multiple graduating years. 2017,2016,2015)
     - Building 3 - (This is a subfolder of "Students that contains multiple graduating years. 2017,2016,2015)

    Desired structure
    Students (root folder)
     - 2015 (This will be a subfolder of students containing all students that will be graduation in 2015)
     - 2016 (This will be a subfolder of students containing all students that will be graduation in 2016)
     - 2017 (This will be a subfolder of students containing all students that will be graduation in 2015)

    I will need logic that looks at the AD OU structure and username to move the current documents folder into the new structure without changing the permissions.
    LVL 34

    Expert Comment

    You can't use robocopy to copy permissions in this case

    you need to create multiple AD groups for every year (Ex:2015, 2016 etc) and add all respective users to that group
    In existing redirection policy, you need to Make sure the setting "Move the contents of My Documents to the new location" is checked \ selected in advance and allow it to replicate to all desktops for at least one week

    Then you need to add more paths in existing redirection policy to reflect new paths
    for ex: original path is \\server1\students\Building1\2015\
    The destination path should be \\server1\students\2015 with "redirect to the following location" selected (offcource you have to pre create AD group named 2015) for this to work

    Test this on test user 1st

    Author Comment

    by:Scott Halford
    Hi again,

    We have an issue with solution that you provided. Our users currently do not have home directories and we would like to migrate their current documents so that we can enable home directories.  I found this tech document that seems to state what we are trying to do is not possible through a redirection policy your help is greatly appreciated.

    Author Comment

    by:Scott Halford
    Sorry I should of mentioned the line I was referring to in the msdn document. "A home directory (only applicable if you have existing home directories in your environment)"

    We need to integrate the home directories so that we can fully setup the Magic Triangle with our newly purchased Macs.
    LVL 34

    Expert Comment

    You need to create home directories explicitly and then need to copy user redirected data to respective home directories

    You can create root share such as \\server1\userdata\2015, \\server1\userdata\2016 and so on
    On batch of 2016 users, select all users and go to properties and enter
    This will ensure that home directories will be created for all users

    Then copy user data to home directories with some small script \ ask user to do that

    I think If you could explain what you are trying to do exactly, I can help

    Author Comment

    by:Scott Halford

    I have created home directories for our users on the new server.  The file structure is as follows..

    Students(root folder)
     - 2015 (folder in which all students home folder who graduate in 2015 are located)
     - 2016 (folder in which all students home folder who graduate in 2015 are located)
     - 2017 (folder in which all students home folder who graduate in 2015 are located)
     - ETC

    Each student is separated by a building OU and by their graduating year. For instance the students in the building Bosti and that are graduating in 2021 are located in the following OU


    I need a script that will look in a specific OU (lets use the case above) and match user names using a loop using RoboCopy. I know this seems crazy but the current location of the documents folders are organized by building, not grade year. I will give and example below. Please excuse my coding :)

    $A = 2021
    $B = Bosti

    If a students OU=$A and is located in OU=$B
    then username output = $C
    For number of users in OU=$A

    Robocopy.exe "O:\\Instructaional\Student Documents\Bosti\2021\$C O:\\Instructaional\Students\2021\$C /E /SEC /COPYALL /V /ETA /TEE /ITEM

    If you could solve this issue it would be greatly appreciated!
    LVL 34

    Expert Comment

    I am not scripting expert, somebody scripting master can help you with the script

    Better you could ask moderator to direct this question to scripting masters

    According to me ask users to move there data from respective locations to home directories, this can be simplest solution
    Good Luck

    Accepted Solution

    I was able to solve this with a blog I found on the web here

    I used AD Manager to export a list of users in the security groups I wanted to copy files for. I then used the above mentioned script to complete the copy.

    Author Closing Comment

    by:Scott Halford
    All other comments did not lead me to the correct solution. I needed to research outside sources to find the desired results

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    PRTG Network Monitor: Intuitive Network Monitoring

    Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

    Suggested Solutions

    Title # Comments Views Activity
    DFS Question 4 19
    exchange 2007 2 21
    exchange, scripts 3 34
    Run Internet Explorer as an administrator from CMD 20 43
    How to remove superseded packages in windows w60 or w61 installation media (.wim) or online system to prevent unnecessary space. w60 means Windows Vista or Windows Server 2008. w61 means Windows 7 or Windows Server 2008 R2. There are various …
    Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
    This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
    This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now