Answered by:
How to copy file security permissions from one server to another one by using Robocopy

Question
-
hi everyone,
I just got this trouble first time in my life :) I just setup a new 2012 file server and restore the data file from Backup exec. All the folders permission seemed to be correct..we also reconfigured the shared permissions.
Now the problem happens. Users reported that their files open as "Read Only". Because of this, they could not save their files. Then I figured it out...the folder permissions are correct, but the file permissions were not correct.
So...may I ask what is the easiest way to copy the file permissions from the old server to the new server? If I use Robocopy, what syntax should I do so I can just copy the coorect permmsions from the old server, and overwrite/replace them on the new server?Thank you very much for your help in advance.
Takami Chiro
Monday, May 16, 2016 7:04 PM
Answers
-
See below for a copy of my Robocopy script i regularly use for this purpose [1]
Copy and paste into Notepad, save it as a .bat file then run it (as a user with admin privileges over source and destination)
Three Main Tips.
- Do NOT get your source and destination the wrong way round. If you do, you will write over your source. Its source first, destination second (ie robocopy \\source \\destination \switches)
- What i do is run a full baseline copy whilst the users are still using the filestore. Then at an agreed time, i make the source read only, run the script again, at which point it updates any changes since the baseline. Both copies should now be identical. Then switch to the destination as the live folder.
- Understand the significance of the /MIR switch and use with care. It will DELETE as well as ADD files on the destination, hence why it is called the MIRROR switch.
HTH
Regards
Mark
[1]
======================
TITLE "Copying ShareA from TestSource to TestDestination"
robocopy \\TestSource\ShareA \\TestDestination\ShareA /MIR /COPYALL /DCOPY:T /R:1 /W:1 /NP /TEE /LOG:C:\Logs\ShareA-RobocopyResults.log
PAUSE======================
The switch functions are as follows:
/MIR - Creates a mirror copy.
/COPYALL - Copies ALL file attributes
/DCOPY - Copies (ie retains original) Directory Creation/Modified Timestamps. If you don't include this, all directories will be recreated with NEW timestamps
/R:1 - Retry copy once on failure
/W:1 - Wait 1 second between retries
/NP - No Percentage Completion written to output
/TEE - Output progress to Command Window (I guess TEE = Terminal Emulation)
/LOG - Write out and save to a specified Log File
Friday, May 20, 2016 1:19 PM
All replies
-
Hi Takami Chiro,
Thanks for your post.
For folder/file migration to to new server, you can use FSMT or robocopy to migrate Files.
Here is Microsoft File Server Migration Toolkit to migrate all the server shared folder from the OLD server to the NEW server.
https://www.microsoft.com/en-us/download/details.aspx?id=10268
The other one is the use of robocopy that will guarantee to you that NTFS permissions would be the same.
For Share permissions, you can just share again your folders and grant Full Control permission to everyone. Like that, once a user will try to access the share remotely, NTFS and Share permissions will be combined and the set NTFS permissions will be applied.
More about robocopy: http://oasysadmin.com/2011/09/26/move-file-share-a-new-server-using-robocopy/
Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
Best Regards,
Mary
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.
Tuesday, May 17, 2016 6:26 AM -
Hi Mary,
Thank you very much for your response! I am sorry to review your post late... It turned out we need to restore the permissions from the backup again...If I like to use the robocopy to recover the original files permission and overwrite the wrong one...which options I should use in robocopy ?
Thank you again,
Takami Chiro- Proposed as answer by Shwarx Sunday, February 3, 2019 1:32 PM
Thursday, May 19, 2016 2:14 PM -
Hi Takami Chiro,
Thanks for your post.
You could refer to the RoboCopy documentation and learning what parameters are available and how to use them.
https://technet.microsoft.com/en-us/library/cc733145.aspx
With the /mir option, if the destination directory exists, the destination directory security settings are overwritten.
And for details scritps, you might need to cofirm in Our scripts forum.
Appreciate your support.
Best Regards,
Mary
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.
Friday, May 20, 2016 7:25 AM -
See below for a copy of my Robocopy script i regularly use for this purpose [1]
Copy and paste into Notepad, save it as a .bat file then run it (as a user with admin privileges over source and destination)
Three Main Tips.
- Do NOT get your source and destination the wrong way round. If you do, you will write over your source. Its source first, destination second (ie robocopy \\source \\destination \switches)
- What i do is run a full baseline copy whilst the users are still using the filestore. Then at an agreed time, i make the source read only, run the script again, at which point it updates any changes since the baseline. Both copies should now be identical. Then switch to the destination as the live folder.
- Understand the significance of the /MIR switch and use with care. It will DELETE as well as ADD files on the destination, hence why it is called the MIRROR switch.
HTH
Regards
Mark
[1]
======================
TITLE "Copying ShareA from TestSource to TestDestination"
robocopy \\TestSource\ShareA \\TestDestination\ShareA /MIR /COPYALL /DCOPY:T /R:1 /W:1 /NP /TEE /LOG:C:\Logs\ShareA-RobocopyResults.log
PAUSE======================
The switch functions are as follows:
/MIR - Creates a mirror copy.
/COPYALL - Copies ALL file attributes
/DCOPY - Copies (ie retains original) Directory Creation/Modified Timestamps. If you don't include this, all directories will be recreated with NEW timestamps
/R:1 - Retry copy once on failure
/W:1 - Wait 1 second between retries
/NP - No Percentage Completion written to output
/TEE - Output progress to Command Window (I guess TEE = Terminal Emulation)
/LOG - Write out and save to a specified Log File
Friday, May 20, 2016 1:19 PM -
Thanks for the above script.
A question, on No 2 above you said
What i do is run a full baseline copy whilst the users are still using the filestore. Then at an agreed time, i make the source read only, run the script again, at which point it updates any changes since the baseline. Both copies should now be identical. Then switch to the destination as the live folder.
Does this mean it will only copy some incremental change, or it will copy all the files a again, for the timewise, similar time or cost less time?
also does any switch above say to overwrite files or mirror means that?
Thanks
Thanks
Monday, August 3, 2020 4:34 PM