Powershell – Add AD User to Group Using Distinguished Name

A colleague of mine had to add a bunch of people to an AD group, but all they had was the names of the people. A couple of problems with that…

1. The name may be wrong

2.There may be more than one account with the same Distinguished Name.

This script accounts for that and will only add the user to the group if the name matches and there is only 1 user with the same name

The CSV file has just on column with a header called Name

 

Leave a comment

Your email address will not be published. Required fields are marked *