PowerShell script that updates AD objects based on a CSV schema.
First, a big thank you to Cary Landers and Nuno Mota.
This effort was adapted from:
- https://companydirectory.codeplex.com/ by Cary Landers
- https://gallery.technet.microsoft.com/scriptcenter/f7b246a4-95a2-4408-b1a1-73b53003883c by Nuno Mota
This script does the following:
- Iterates through records in a CSV
- For each record, looks up the AD object's distinguishedName based on the AccountName in the CSV
- Updates the AD object based on the other properties specified in the CSV
The project provides both the PowerShell script and a sample CSV. To test the script as-is, all you need to do is create three user objects in AD as testuser1, testuser2, and testuser3 (view the CSV in Excel and refer to the first column).
Once you've created those three users, you should be able to run the script and be able to open the attribute editor for testuser1, testuser2, and testuser3 to see their updated values.
Before running the script, we see that testuser3 has no address, city, state, or zip.
Here's an amazing capture of what happens when you run the script.
Finally, we check and see that testuser3 now lives somewhere!
Questions and comments are welcome: firstname.lastname@example.org.