Migrating files and folders with Robocopy
An often task in every administrators daily job, is to migrate users files and folders f.x users home directories from one fileserver to another.
A great tool who most of the windows sysadmins is aware of or should be aware of, is called Robocopy.
Here is a simple command / script to accomplish a file server migration, keeping NTFS perssions etc. in tact;
“%~dp0\robocopy.exe” SOURCE DESTINATION /E /SEC /COPYALL /ZB /V /ETA /TEE /LOG:”%~dp0\FileMigration.log”
A little output of some of the many parameters you are able to apply to robocopy;
I used these for a simple User Home Directory migration from one fileserver to another.
…………
/E – Copies subdirectories including empty ones
/SEC – Copy files with security
/COPYALL – Copies ALL file info
/ZB – Use restartable mode (useful if f.x your mapped network shares suddenly disconnects during the copy)
/V – Verbose output – showing skipped files
/ETA – Show estimated time of arrival of copied files
/TEE – outputs to console windows as well as the log file
/LOG – outputs status to specified log file
For Windows 2k3, Robocopy is available in a GUI version;
http://technet.microsoft.com/en-us/magazine/2006.11.utilityspotlight.aspx
And a command line version in the 2003 server ressource kit;
http://www.microsoft.com/downloads/details.aspx?FamilyID=9D467A69-57FF-4AE7-96EE-B18C4790CFFD&displaylang=en
Additional file utilities;
The ordinary Ntbackup.exe is also a simple and useful method to backup and restore f.x folders with security settings etc.
To export shares and share permissions, these a stored in the registry area as follows;
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\lanmanserver\Shares
Another tool from Microsoft is ShareEnum, which lists all shares with details on permissions etc. this can then be exported.
ShareEnum source;
http://technet.microsoft.com/en-us/sysinternals/bb897442.aspx
SubInACL from Microsoft, is also a command line tool that enables administrators to obtain detailed security information and transfer this from user to user or domain to domain etc.
SubInACL Source;
http://www.microsoft.com/downloads/details.aspx?FamilyID=E8BA3E56-D8FE-4A91-93CF-ED6985E3927B&displaylang=en