A small side step.
Perhaps its simplier to recreate all users folders using batch, setting the correct share and folders permsissions using nt recource kit programs, XCACLS.EXE and rmtshare.exe.
Code:
for /f %%x in (d:\new_users.txt) do md %%x >>d:\log.txt
for /f %%x in (d:\new_users.txt) do xcacls d:\users\%%x /g "New_domain\Domain Admins":F /y
for /f %%x in (d:\new_users.txt) do xcacls d:\users\%%x /e /g new_domain\%%x:F /y
for /f %%x in (d:\new_users.txt) do rmtshare \\filesrv\%%x$=d:\users\%%x /grant "new_domain\Domain Users":"full control" >>d:\log.txt
This batch code is fast and works
But one problem still exist.
Ex user: adam bertil
old share "abt$"
new share "adam.bertil$"
How to copy from the old share to the new.
I have tried
Code:
for /f %%n in (n:\old_users.txt) do xcopy \\filesrv\%%n$\*.* Filesrv\%%x$\ /S /E /D
but theres no referense between old and new username.
also tried readline but my I am unable to figure out how to extract $old and $new.
Tried left and right but old usernames are not precis.
Seems like some kind of array is the solution, but I don know how to.
My ex:
Users.txt
abt,adam.bertil
How to split and get $a and $b, then make the copy
\erik