We were moving data with a tool called Syncedtool. It works pretty good, however the biggest downfall is, it does not copy NTFS permissions… UGG!

So here my Batch fix for it. Since PowerShell is a pain to be used to that…

::Since it has multiple folders I need to replace, I put it in a loop
:start
::subinACL installs in that folder and has to be used from there
cd C:\Program Files (x86)\Windows Resource Kits\Tools
set /p folder=Set the Data Path:
::First we clean out all permissions and get rid of the faulty ones
subinacl /subdirectories D:\users\%folder% /perm
subinacl /subdirectories D:\users\%folder% /grant=system=F
subinacl /subdirectories D:\users\%folder% /grant=<user1>=F
subinacl /subdirectories D:\users\%folder% /grant=administrators=F
subinacl /subdirectories D:\users\%folder% /grant="Domain Admin"=F
::Here we grant the user of the folder access to his folder
subinacl /subdirectories D:\users\%folder% /grant="<domain>\%folder%"=F
subinacl /subdirectories D:\users\%folder%\* /grant="everyone"=F
echo Finished for %folder%
goto start