Link to home
Start Free TrialLog in
Avatar of Kram80
Kram80

asked on

Moving User's Home Directories

So I moved user's home directories to a new server.  Sounds simple enough, right?  The user directories are sitting on the new server needing permission granted to the user.  I thought I would be able to select multiple users in AD, change the home directory path with the %username% wildcard and be on my way.  Wrong!  Errors out saying folder already created.  Doesn't assign permissions.  To make matters worse, I think I've fallen into this trap before.  So I'm stuck doing it one by one waiting for permissions to assign to every file and folder a user has.

For future reference, is there anything I could have done differently?
Avatar of bcdudley
bcdudley
Flag of United States of America image

I use a bat file like this to set permissions:

cacls e:\home\ /t /g "domain admins":f
cacls e:\home\ /t /e /g "System":f 
cacls e:\home\ /t /e /g "Creator Owner":f 
For /d %%f IN (*) Do cacls %%f /t /e /g %%f:f

Open in new window


This will reset all permissions for full control for domain admins, then ad system and owner with full as well.
ASKER CERTIFIED SOLUTION
Avatar of bcdudley
bcdudley
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Kram80
Kram80

ASKER

With those Robocopy options I'm guessing it copies over permissions too?
Yes, The options are:

  /SEC :: copy files with SECurity (equivalent to /COPY:DATS).
  /COPYALL :: COPY ALL file info (equivalent to /COPY:DATSOU).
  /MIR :: MIRror a directory tree (equivalent to /E plus /PURGE).

The /SEC copies security settings, /Copyall makes an identical copy and /MIR will make an exact copy of the original directory, including deleting any files that do not exist from the source directory. Robocopy is a Microsoft program similiar to xcopy, but with lots more options. I use it for all my big copies now.
Couldn't you also, on the new server, rename the folder holding the home directories, then in AD, use your %USERPROFILE% option, after completed, move the home directories to their new home?
You would have to move them to a different drive on the server. From what I recall, If you copy files from the same drive, they will retain the permissions. When you move them to a different drive, the permissions reset to the parent directory. Either way could result in inconsistent or undesired permissions.

Using Robocopy is the safest way to maintain permissions. Using the cacls script I provided is the safest way to reset them.