Copy file permissions in batch script with robocopy

Hey Experts.  I have copied over all the data from the old file server to the new file server.  However, some of the permissions on the old file server didn't transfer over.  I checked and the permissions are fine on the old file server and the data is there but the permissions didn't assign properly.

How do I copy the permissions (NTFS) over but not the data again?  I found a couple of switches to use with robocopy in the batch file but before I monkey it up this close to the go live date (Thu), I figured I would ask the brightest minds!

Thank you for your help and time!
LVL 9
samiam41Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

NVITCommented:
Did you try the /E /Copy:S /IS /IT switches?

ROBOCOPY /Mir <Source> <Target>

ROBOCOPY /E /Copy:S /IS /IT <Source> <Target>

The first Robocopy command above will copy data and security for files that have been updated, and the second Robocopy command will refresh file security for all files, without copying any file data.

http://blogs.technet.com/b/filecab/archive/2008/07/31/robocopy-mir-switch-mirroring-file-permissions.aspx
0
F PCommented:
I personally like to use DFS, distributed file shares, and Active Directory, to do the job for me. Little easier to setup.

https://msdn.microsoft.com/en-us/library/bb727150.aspx
0
F PCommented:
... BTW, DFS will do synchronization, and you can point the users to a \\domain.tld\share share instead of a single server so there is no need to make any changes or worry about things after it syncs.
0
Making Bulk Changes to Active Directory

Watch this video to see how easy it is to make mass changes to Active Directory from an external text file without using complicated scripts.

arnoldCommented:
You can not just reset permissions using robocopy without copying the files..
0
samiam41Author Commented:
@Arnold, ok, then how would you do it if you copied files?  

@frank pennock, I appreciate the information on that and will look into it as soon as I stamp out this fire.

@nvit, I've tried both and the log files show "skipped" on the files.  Thoughts?
0
arnoldCommented:
The option without copying the file, is to use
icacls topof_directory /T /save d:\aclfile_top_of_directory

Then you do on the destination with the aclfile_top_of_directory transferred/copied
icacls topof_directory /restore aclfile_top_of_directory


Note this will only apply to the files copied, if new files were added in the interim on the new location, the will not be in the reference and will not be changed.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
arnoldCommented:
Need clarification, are you certain the issue relates to security settings (NTFS file level) or it is the issue with security settings on the share that denies users write rights.
Usually, the default share permissions are read-only such that while one can access shares and see files, they will be denied write rights into the share unless the share permissions reflect groups/accounts with write rights.
0
samiam41Author Commented:
Usually, the default share permissions are read-only such that while one can access shares and see files, they will be denied write rights into the share unless the share permissions reflect groups/accounts with write rights.

When I look at the NTFS/permissions on each user directory on the new FS, the settings don't match the NTFS/permissions on each user directory on the old FS.  I am manually changing them as tomorrow is the go live date.  While there are a couple hundred, I'm not opposed to having an answer before I complete this so please post back any ideas.
0
arnoldCommented:
See earlier comment using icacls.
Icacls only deals with the ntfrs security settings.
0
samiam41Author Commented:
Just ran this on the old server:

icacls \\oldfs\users /T /C /save c:\tools\logs\aclfile_top_of_directory

which dumped a lot of info into the "aclfile_top_of_directory" file.  

Now to get those permissions on the directory on the new server, is this what I would run (making sure I put that file "aclfile_top_of_directory" in the c:\tools\logs directory on the new server)

icacls \\w2k12fs01\users /T /C /restore c:\tools\logs\aclfile_top_of_directory
0
arnoldCommented:
I do not think you need to use the /T /C on the restore side.

Test first on a smaller set of files.
/T will repetitively reassert security settings which if run on restore could take a long time .....
0
samiam41Author Commented:
Lesson 1 learned, when restoring the permissions to the new server, exclude the last directory (instead of icacls \\newfs01\users, use \\newfs01\)

Trying to figure out why the individual user accounts listed on the ntfs permission side wasn't a) captured in the save file and/or b) restored to the new file server.  Working on learning lesson 2.
0
arnoldCommented:
Nets permissions should be captured directly on the system not via share.
0
samiam41Author Commented:
Lesson 2 learned, make sure you give the script enough time when dealing with 290 items.  The script just finished and it looks EXACTLY like I needed it to!

Great work, arnold!
0
samiam41Author Commented:
This worked just as the expert explained!

Thanks for your help and time.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.