Geeks With Blogs
Blog Moved to http://podwysocki.codebetter.com/ Blog Moved to http://podwysocki.codebetter.com/
When I was helping out a coworker with an issue for data mining for a logging and auditing ISAPI tool that we created (don't worry I'll get to the basic concepts of what we did), we realized we needed an easy way to pull information from AD easily during our data loads. 
 
SQL Server makes this easy of course with the OLE DB Provider for Directory Services.  Information about this can be found here:  http://msdn2.microsoft.com/en-US/library/ms190803.aspx for SQL Server 2005.  The reference from ADO 2.8 also makes note of this technology here:  http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdrefadsprovspec.asp
 
This gives you the ability to use user names and passwords through SQL Server logins, although I would definitely recommand against such a procedure for security purposes and maintenance.  You can accomplish this however the sp_addlinkedsrvlogin system stored procedure.
 
Querying the AD object model is very simple from this example:
 
CREATE VIEW viewADEmails
AS
SELECT
[Name], SN [Last Name], email
FROM OPENQUERY( ADSI,
   'SELECT Name, SN, email
   FROM ''LDAP://DC=microsoft,DC=com''
   WHERE objectClass=''user'' AND objectCategory=''Person'''
)
GO
SELECT * FROM viewADEmails
 
 
Posted on Wednesday, May 3, 2006 8:56 PM SQL Server | Back to top


Comments on this post: OLE DB Provider for Directory Services

No comments posted yet.
Your comment:
 (will show your gravatar)


Copyright © Matthew Podwysocki | Powered by: GeeksWithBlogs.net