Adam Bertram

Syncing a CSV with Active Directory

This series of PowerShell tips and tricks is an on-going collaboration between NinjaRMM and Adam Bertram, Microsoft MVP.

One of the most common applications of PowerShell that I see IT professional is syncing information with Active Directory (AD). It seems like everyone has some external data source that correlates to some employees that we need to get into AD. This is to be expected because AD typically is the most used IT service in an organization and provides an excellent feature not just as authentication but as a repository of employee information.

Whether you’ve got data stored in a custom SQL database or some fancy HR system, it sucks to have to check two spots if you need information like employee department, groups that employee should be a member of and so on. When you do begin to sync that data, the source system may change its schema, may change APIs, servers and so on which means a code rework. To ensure the data source you’re syncing from always stays the same and can easily be created from any number of systems, it’s a good idea to get that data into a CSV file.

A simple CSV file can be exported from just about any software or database and when in this format, gives the administrator a copy that can be tweaked as well as necessary foregoing the requests from another team to change up a database somewhere.

Read more