Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Comparing contents of OUs

Posted on 2007-04-01
3
Medium Priority
?
273 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 2000 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This may not be a text book method to resolve VSS backup issues but it seemed to have worked on few of the Windows 2003 servers we had issues while performing a Volume Shadow Copy backup. If you have issues while performing a shadow copy backup usin…
Learn about cloud computing and its benefits for small business owners.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

721 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