Solved

Comparing contents of OUs

Posted on 2007-04-01
3
272 Views
Last Modified: 2010-04-18
Hi there,

I have two OUs containing lists of users.  I think that both OUs contain the same users, but I need to double check this.  I need for both OUs to contain exactly the same users as each other.

I would like to know if there is a way to compare these two OUs so I can see if there are users that exist in one OU but not the other?

Thanks!
0
Comment
Question by:peterkennedy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 48

Expert Comment

by:Jay_Jay70
ID: 18834628
peterkennedy,

you could output the list of each OU to a file using the dsquery commands

Regards,

James
0
 
LVL 67

Accepted Solution

by:
sirbounty earned 500 total points
ID: 18835490
This script may help...save as CompareOUs.vbs and after modifiying the OU1 and OU2 LDAP entries, double-click it to run...

'CompareOUs.vbs
Dim arrOU1():OU1="LDAP://OU=FirstOU,dc=domain,dc=com"
Dim arrOU2():OU2="LDAP://OU=SecondOU,dc=domain,dc=com"
x=0
Set colItems = GetObject (OU1)
For Each objItem in colItems
    ReDim Preserve arrOU1(x)
    arrOU1(x)=objItem.Name
    x=x+1
Next
x=0
Set colItems = GetObject (OU2)
For Each objItem in colItems
    ReDim Preserve arrOU2(x)
    arrOU2(x)=objItem.Name
    x=x+1
Next
For x = 0 to ubound(arrOU1)
  If arrOU1(x) <> arrOU2(x) Then
      wscript.echo arrOU1(x) & " appears to be different."
  End If
Next
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 18850342
Happy to help - thanx for the grade! :^)
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, I had the need to build a standalone system to run a point-of-sale system. I’m running this on a low-voltage Atom processor, so I wanted a light-weight operating system, but still needed Windows. I chose to use Microsoft Windows Server 200…
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question