Active Directory User Details Sync to SQL Server


I need to develop an application that will automatically sync user details from many Active Directories into a SQL Database. Any help on this will be really appreciated. I am developing in VB.NET or C#.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mark WillsTopic AdvisorCommented:
Well, you can create linked servers, but not if the remote servers are not part of a trusted domain. So, then you might need to explore first creating a csv and then import those.

But, from your central SQL server you can import via a stored procedure (or SSIS package) the required information in either format.

So, you code would first create the AD export and then call the SQL import.

I havent needed to play with this for a while, and there are no doubt some wonderous Powershell examples out there... But to get you started check out :

There are samples around like :
and an older one going directly to AD from SQL :

Creating the csv's in the first place you do have a few options - one such is : and using the LDIFDE utility :

You might like to describe your environment a bit more, and also what tools / experience and editions/versions you are using.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Active Directory

From novice to tech pro — start learning today.