Update active directory user from Windows Service

A

Adam

Hi, I have a windows service that will pull data from an external
source and I need to update this informaiton in AD from a Windows
Service.

What is the easiest way to do this? I looked at using the
ActiveDirectoryMembershipProvider but it seems that this is for
ASP.NET applications only(?) or perhaps I am missing some better
results in google.

I know that I can connect via LDAP and change details using code like
the following

DirectorySearcher search = new DirectorySearcher();
search.Filter = String.Format("(SAMAccountName={0})",
userName);
search.PropertiesToLoad.Add("cn");
SearchResult result = search.FindOne();

but I was wondering if there was a better way?

Thanks for any help
Adam
 
A

Alvin Bruney - ASP.NET MVP

Use LINQ2AD (Linq to active directory, this is about as easy as it gets and
you won't have to do all this tedious, error prone formatting.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top