Solved

Comparing contents of OUs

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

by Batuhan Cetin Within the dynamic life of an IT administrator, we hold many information in our minds like user names, passwords, IDs, phone numbers, incomes, service tags, bills and the order from our wives to buy milk when coming back to home.…
Scenerio: You have a server running Server 2003 and have applied a retail pack of Terminal Server Licenses.  You want to change servers or your server has crashed and you need to reapply the Terminal Server Licenses. When you enter the 16-digit lic…

710 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