Solved

Comparing contents of OUs

Posted on 2007-04-01
3
269 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
  • 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
inactive users 13 77
Best practices power settings GPO Win 10 4 95
Event-ID 3001, 3011 - LoadPerf - Windows Server 2003 14 42
SBS 2003 RWW Login 3 35
So you have two Windows Servers and you have a directory/folder/files on one that you'd like to mirror to the other?  You don't really want to deal with DFS or a 3rd party solution like Doubletake. You can use Robocopy from the Windows Server 200…
A quick step-by-step overview of installing and configuring Carbonite Server Backup.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

806 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