Announcement

Collapse
No announcement yet.

Script to compare ADUC contatiner contents

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Script to compare ADUC contatiner contents

    Hi Everyone,
    I searched the forums but couldn't really find what I was looking for, so I thought I'd post.

    I'm looking for a script that will compare the contents of two containers in my AD tree and report back if it finds somthing in one container that's not in the other one. There's a little bit of a catch though. The data in one container has to be silghtly parsed. Here's an example of what I need:

    Container 1 - object is a user with the display name:
    Smith, Robert

    Container 2 - object is a contact with the display name:
    SMS - Smith, Robert

    So this would be a match. No reporting.

    The logic would be - If display name of object in container 1 is contained in the display name of object in container 2 (match is made) then go to next object.

    If no match for object in container 1 is found - write the display name of that objet to a txt file on the local hard drive.

    Sorry if this seems complicated, hope I explained it right. I've been using dsquery and dsget to gather the container info and then massaging the data in excel, but I know there must be an easier way.

    Thanks everyone,
    Charlie - paxwo13(at sign)yahoo-dot-com
    Last edited by paxwo13; 19th June 2009, 20:45.

  • #2
    Re: Script to compare ADUC contatiner contents

    Charlie,
    To save yourself from major spamming, please remove (or break) the live email link
    I have reported this post to a moderator for that reason so it may be done for you

    To deal with your problem, can I suggest some lateral thinking and export your AD to Excel using CSVDE and then some IF functions. That may well be the easiest way!
    Tom Jones
    MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
    PhD, MSc, FIAP, MIITT
    IT Trainer / Consultant
    Ossian Ltd
    Scotland

    ** Remember to give credit where credit is due and leave reputation points where appropriate **

    Comment


    • #3
      Re: Script to compare ADUC contatiner contents

      Yikes! I forgot about that. Thanks for the heads up. I'll looke into CSVDE and then some IF functions.

      Thanks,
      Charlie

      Comment


      • #4
        Re: Script to compare ADUC contatiner contents

        Originally posted by paxwo13 View Post
        Container 1 - object is a user with the display name:
        Smith, Robert

        Container 2 - object is a contact with the display name:
        SMS - Smith, Robert

        So this would be a match. No reporting.
        In fact it is not an exact match of course. Can you describe a pattern for the script to test?

        like,
        1. Are the display names of the objects in OU-1 always part of the longer display names shown in container-2? Are the objects in OU-1 all user objects?
        2. are the display names of the objects from OU-1 always typed exactly as it is used in the display names of the objects in OU-2? Are the object in OU-2 all contacts?
        3. should all objects from OU-1 have to be associated with at leased one object in OU-2
        OR, should every object from OU-2 be associated with one object from OU-1??
        4. Is the user display name always placed after a dash at the end of the display name of each contact in OU-2?

        If 1 and 2 are a 'yes' and the first choice from 3 - then you simply could write a script that first create a vb-Dictionary or array populated with the display names from the all objects from container-2.
        Then compare each object display name from container-1 with the strings in the Dictionary (it is best to use regular expression for matching a set of exact words in a string).


        \Rems
        Last edited by Rems; 23rd June 2009, 06:17.

        This posting is provided "AS IS" with no warranties, and confers no rights.

        __________________

        ** Remember to give credit where credit's due **
        and leave Reputation Points for meaningful posts

        Comment

        Working...
        X