Checking for duplictes in AD Database

This topic contains 4 replies, has 3 voices, and was last updated by Profile photo of Richard Siddaway Richard Siddaway 3 months, 2 weeks ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #42497
    Profile photo of crashrebootrepeat
    crashrebootrepeat
    Participant

    My organization has some custom attributes assigned to users. I am able to query on these attributes by selecting the property as well as write to the attribute. What I need to so is be able to have a script check to make sure that the data being provided isn't already assigned to another user and return a warning if there is. I somewhat understand how to do this with SQL but the AD database isn't SQL so not really sure how I can check that information.

    #42509
    Profile photo of Wilfredo Perez
    Wilfredo Perez
    Participant

    Can you show us your script and give us an example of the attribute

    #42527

    You could do something like

    Get-AdUser -Filter * -Properties attributename | group -Property attributename | sort Count -Descending | where Count -gt 1

    If the attribute truly is unique then should get nothing back. Any duplicates will have a Count of 2 or more

    #42559
    Profile photo of crashrebootrepeat
    crashrebootrepeat
    Participant

    This is not complex enough, I need to be able to enter the user name and enter what the value I want it to be. Then it needs to go through and search every user in the AD and make sure that number doesn't exist.

    #42619

    Do your search as an LDAP filter on that attribute – is the attribute indexed in your AD for fast searches?

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.