How to quickly migrate home folders following server move

metamatic
metamatic used Ask the Experts™
on
My server is running 2003 server standard edition R2. I've just bought a new server with the same OS and want to quickly migrate approx 80 users profiles and home folders.

Can aybody let me know a quick way to do this without having to go through AD Users and Computers for each user and manually edit the paths.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Markus VordererOwn Company

Commented:
Use robocopy from Microsoft. This is in the Ressource Kit.
Own Company
Commented:
Again.
Also write down a vbs script to change the server names in the Profile Path.

Here a example

Call BatchAddUser

Function BatchAddUser()
Dim oUser 'As IADsUser
Dim oRootDSE 'As IADs
Dim strDomainNC
Dim conn
Dim rs
Dim SQLStr
Dim adOU
Dim usercount
Dim UserPath

' Get the Domain name
Set oRootDSE = GetObject("LDAP://RootDSE")
strDomainNC = oRootDSE.Get("defaultNamingContext")

Set conn = CreateObject("ADODB.Connection")

conn.Open "Provider =Microsoft.Jet.OLEDB.4.0;Data Source=" & "N:\mvs.edv\activedirectory\mappe2.xls;Extended Properties=Excel 8.0;"
Set rs = CreateObject("ADODB.Recordset.2.5")
SQLStr = "SELECT * FROM [Tabelle2$]"
rs.Open SQLStr, conn, 3, 1

Do Until rs.EOF
Dim OUPath
OUPath = "LDAP://OU=" & Trim(rs("OU2")) & ",OU=" & Trim(rs("OU1")) & "," & strDomainNC


      If rs("name") <> "" And Not IsNull(rs("name")) Then
      Set adOU = GetObject(OUPath)

      If FindUser(strDomainNC, rs("LogonName"), "", UserPath) = -1 Then

      Set oUser = adOU.Create("user", "cn= " & rs("name"))

      oUser.Put "samAccountName", "" & rs("LogonName") & ""      
      oUser.Put "DisplayName", "" & rs("name") & ", " & rs("givenName") & ""
      oUser.Put "sn", "" & rs("name") & "" 'Nachname      
      oUser.Put "givenName", "" & rs("givenName") & "" 'Vorname      
      oUser.Put "TelephoneNumber", "030 / 611 28 40-" & rs("TelNo") & ""
      oUser.EmailAddress = rs("givenName") & "." & rs("name") & "@bbh-berlin.de"      
      oUser.put "department", "" & rs("Team") & "" 'Abteilung !!!!      
      oUser.put "description", "" & rs("Position") & ""  'Beschreibung !!!
            
      If Not IsNull(rs("logonName")) Then
            oUser.Put "userPrincipalName", rs("LogonName") & "@bbh-muenchen.local"
            End If
     
            oUser.Put "streetAddress", "Köpenicker Strasse 9" 'Strasse !!!!
      oUser.Put "l", "Berlin" 'Stadt !!!!
      'oUser.Put "st", "Bayern" 'Bundesland !!!!
      oUser.Put "postalCode", "10997" 'PLZ !!!!
      oUser.Put "c", "DE" 'Land 2 Zeichen!!!!
      oUser.Put "wWWHomePage", "http://www.bbh-berlin.de" 'Web Adresse !!!
      oUser.Put "scriptPath", "login.bat" 'loginscript !!!!
            
            oUser.Put "pwdLastSet", -1
      oUser.SetInfo
      ouser.put "userPassword", "bbh"
      oUser.Put "useraccountcontrol", "544" 'Benutzer aktivieren (544), Benutzer deak. (546) !!!
      oUser.Put "userAccountControl",66080 ' Benutzer kann Kennwort nicht ändern / Kennwort läuft nie ab (66080)!!!

      oUser.SetInfo
            usercount = usercount + 1
 Else
'Move the object to the OU
    adOU.MoveHere UserPath, vbNullString
 
   End If
End If
   rs.MoveNext
Loop

MsgBox "Successfully imported all the information"
rs.Close
conn.Close
Set rs = Nothing
Set conn = Nothing

End Function


'*********************************************************
' Function:     Find a user and return it's ADs Path.
' Return:       1 -- Success( No same user existed
'               -1-- Failed( The same has existed)
'
' Parameter:    strDomainNC: DefaultNamingContext;
'                   For example, DC=dcmini,DC=fareast,DC=microsoft,DC=com
'
'               strUser: The user to be created
'
'               strOU: The OU the user to be created in
'*********************************************************
Function FindUser(ByVal strDomainNC , strUser , strOU, UserPath)
                       
    Dim con 'As ADODB.Connection
    Dim Command 'As ADODB.Command
    Dim rs 'As ADODB.Recordset
    Dim strQuery 'As String
   

    FindUser = 1
   
    Set con = CreateObject("ADODB.Connection")
    con.Provider = "ADsDSOObject"
    con.Open "ADs Provider"
   
    Set Command = CreateObject("ADODB.Command")
    Set Command.ActiveConnection = con
   
   'strQuery = "<LDAP://OU=" + strOU + "," + strDomainNC & ">;(objectCategory=User);cn,adspath;subtree"
    strQuery = "<LDAP://" & strDomainNC & ">;(objectCategory=User);cn,adspath;subtree"
    Command.CommandText = strQuery
 
    Set rs = Command.Execute
    rs.Filter = "CN='" + strUser + "'"
   
 If rs.EOF Then
      
        FindUser = -1
        UserPath = ""
    Else
        UserPath = rs("ADsPath")
        FindUser = 1

    End If


    Set rs = Nothing
    Set Command = Nothing
   
    con.Close
    Set con = Nothing
   
End Function



Author

Commented:
I've already downloaded robocopy and was going to use that to actually copy the files. However, does robocopy also offer a way to update the paths to the profiles for each individual user? If so can you let me know the syntax to do this?
Top Expert 2012

Commented:
You can use robocopy or have the GPO move the contents for you but if you move with robocopy make sure when you point to the new location that you tell the GPO not to move contents.

http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Server/Windows_Server_2008/Q_26185635.html
Top Expert 2012

Commented:
You would need to change the path in the GPO

Author

Commented:
cheers

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial