Windows: Robocopy all files, share permissions and NTFS security attributes to new servers

Robocopy is the tool of choice for copying files between Windows machines. Not only does it compare files and copy what’s changed, it can copy all NTFS security permissions along with the files and folders as well. This is particularly important in high security environments where share permissions are just not enough, and administrators rely on security permissions to lock down access down to files or folders within a partition. The command below is what I used to copy 15TB of ACL based data to a new server:

ROBOCOPY Q:\ X:\ /S /J /ZB /MIR /DCOPY:DAT /COPY:DATSOU /SECFIX /TIMFIX /MT:48 /R:3 /W:5 /XD: "SYSTEM VOLUME INFORMATION" RECYCLER $RECYCLE.BIN RECYCLED /LOG+:C:\ROBO181215.LOG

With the above command you copy everything you specify from source server/disk to destination with all security information, and every time the command is run it will double check the permissions and modifies as necessary. It will also exclude the folders specified after /xd switch.

It is important to note that when you copy files to a Windows 2012 server, you may not have explicit security permissions to source folders and when you click on destination folder you will be asked to click continue to get access. This will alter destination folders’ security permissions, and will force robocopy to fix them during next sync. This will prolong the sync operation significantly. Therefore, if you need to run this command a few times till it is time to cut over to new server, do not view what is in those folders and force permission change until you are done. Simply run the command as many times as needed till it is time to migrate. Once you are on the new server then feel free to alter those permissions and fix what needs to be fixed.

To migrate shares to new server, simply export registry key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\Shares and import onto the new server and reboot. All your shares will be active on the new server immediately.

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.