We help IT Professionals succeed at work.

Find out Duplicate Name Object in AD

Hi Members,

We are going to dissolve our child domain and migrate child objects into Parent Domain

we are using ADMT v3.2 for migration

but problem is that there are lots of obj in our child domain whose name are same in parent domain

Example :

A User Zeeshan.Ali exists in child domain and also exists in Parent Domain ( Where we going to migrate our obj)

So if we know Same in Starting with any tool then we can set documents these users and change there names

kind Regards,
Watch Question

I use a vbscript to compare the export of one database (oldADUsers.txt)  to the new AD database (newADUsers.txt).

Export all your users from the old AD into a comma deleminited file.  
Use the following script to check the file of old users to the new ad tree, setting the context to the approptiate tree.

On Error Resume Next

'* Constants for the FSO (File System Object)
Const ForRead = 1    'Opens file for reading
Const ForWriting = 2 'Opens file for writing, overwriting file
Const ForAppend = 8  'Opens file for Appending
Const OverwriteExisting = True
Const NoOverWrite = False

'* Set connections to ADO DataBase objects
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand =   CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection

'* Open the input file and log file
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objInputFile = objFSO.OpenTextFile("C:\temp\OldADUsers.txt", ForRead)
If Err.Number <> 0 Then
     WScript.Echo "The OldADUsers.txt error is " & Err.Description
     WScript.Sleep 2000
End If

Set objOutputFile = objFSO.OpenTextFile("C:\temp\NewADUsers.txt", ForWriting)
If Err.Number <> 0 Then
     WScript.Echo "The NewStudents.txt error is " & Err.Description
     WScript.Sleep 2000
End If
intNewUsers = 0
boolFoundUser = False  
intStudentRecord = 1
Do Until  objInputFile.AtEndOfStream
     WScript.Echo intStudentRecord
      strStudentData = objInputFile.ReadLine
      arrStrSplit = Split(strStudentData, ",")
      strUser = arrStrSplit(0)
      'WScript.Echo "strUser is " & strUser
      objCommand.Properties("Page Size") = 1000
      objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
      objCommand.CommandText = _
          "SELECT distinguishedName FROM 'LDAP://dc=(YOUR CONTEXT HERE)objectCategory='user'AND sAMAccountName='" & strUser & "'"
      Set objRecordSet = objCommand.Execute
      If objRecordSet.EOF Then
            WScript.Echo "User " & strStudentData & " was not found."
            intNewUsers = intNewUsers + 1
            objOutputFile.WriteLine strStudentData
            WScript.Echo "Found " & intNewUsers & " new users."
            Do Until objRecordSet.EOF
                strDN = objRecordSet.Fields("distinguishedName").Value
                'WScript.Echo "The distinguished name is " & strDN
      End If
      intStudentRecord = intStudentRecord + 1
WScript.Echo "Found " & intNewUsers & " new users."