Wednesday 13 February 2013

Migrate Active Directory Home Folder from Windows Server 2003 to 2008


 Copy all the data across to new server using xcopy


log onto the file server where all home folder resides and run:

xcopy souce dectination /I /C /E /Y

(remember ICEY for switches )

 /I           If destination does not exist and copying more than one file,
             assumes that destination must be a directory.

 /C           Continues copying even if errors occur.
 /E           Copies directories and subdirectories, including empty ones.
 /Y           Suppresses prompting to confirm you want to overwrite an



Get usernames of staff on current file server to be migrated from Active Directory Home Folder Path filter

dsquery * dc=testdomain,dc=com -filter "(&(objectCategory=Person)(objectClass=User)(HomeDirectory=\5c\5cFILEServer1\5cHomeFolder\5c*))" -attr samAccountName > report.txt

 (5c tells dsquery that '\' is not part of the command and string instead)

Modify the Active Directory Home Folder Path


create a batch file:



for /f "eol=; tokens=1" %%i in (
report.txt) do call :PROCESS %%i

goto :EOF


:PROCESS
set var=%*
 

dsquery * dc=testdomain,dc=com -filter "(&(objectCategory=Person)(objectClass=User)(HomeDirectory=\5c\5cFILEServer1\5cHomeFolder\5c%var%))" | dsmod user -hmdir \\FILEServer2\HomeFolder\%var%\

:Exit



No comments:

Post a Comment