Hey! As we enter the waning days of summer, I wanted to update a tool that I’ve had sitting around for a while.
Years ago, when I was in Microsoft Consulting Services, I ran into one particular customer that had manually populated the mail property of thousands of service accounts, groups, vendor accounts, and contacts–not with the object or user’s individual email address, but with the email address of the person who managed the AD object. Thus, the Find-DuplicateValues script was born to help sort that out during a particularly large number of angrygrams from AAD Connect.
The tool largely sat dormant for years, and when we shut down the TechNet Gallery, I moved it over to the PowerShell Gallery without testing it on newer versions of PowerShell or Windows. This week, someone asked for a little help on it. Upon digging in, I could replicate a problem where when running it with certain combinations of parameters, it doesn’t always display helpful output to screen. So, I’ve resolved that, as well as a bunch of other things:
- I’ve updated the way the legacy LDAP-style filtering is processed through the
FormatColorfunction (which is used to highlight the duplicate values), so it’s now consistent with how it’s done in other places in the script. It would cause data to not be displayed in certain places. - I re-used the
VerifyADToolsfunction to determine (and optionally, install with the-InstallDependenciesparameter) the Active Directory Remote Server Administration Tools. - Finally, I added a smidgen of checking/handling for when you supply either the
-IncludeExchangeor-IncludeSIPparameters, but don’t actually have your schema extended. Instead of seeing script errors, you’ll see some text that will guide you to the correct cmdlets to extend the schema and our corresponding documentation.

You can access this via PowerShell Gallery or install/update directly from your CLI:
Install: Install-Script Find-DuplicateValues
Update: Update-Script Find-DuplicateValues
And the script itself: https://www.powershellgallery.com/packages/Find-DuplicateValues/

