- June 9, 2016 at 9:11 pm #42497
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.June 10, 2016 at 12:26 am #42509
Can you show us your script and give us an example of the attributeJune 10, 2016 at 11:02 am #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
June 10, 2016 at 4:21 pm #42559
- This reply was modified 3 months, 2 weeks ago by Richard Siddaway.
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.June 12, 2016 at 9:25 am #42619
Do your search as an LDAP filter on that attribute – is the attribute indexed in your AD for fast searches?
You must be logged in to reply to this topic.