dbTalk Databases Forums  

import info from Active directory into SQL table.

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss import info from Active directory into SQL table. in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Gunna
 
Posts: n/a

Default import info from Active directory into SQL table. - 01-14-2009 , 07:20 PM






Hi there,

Im fairly green at SQL so need a little help. I have a simple table with 2
columns. One is called userID and the second is called fullname

I need some help getting my SQl server to connect to an Active directory
server and for all users export the userID and the fullname and put this nifo
into the table. Simple enough. Can anyone help me do this? Also can it be
made dynamic or at least scheduled to keep itself up to date?

Thanks.

Reply With Quote
  #2  
Old   
Todd C
 
Posts: n/a

Default RE: import info from Active directory into SQL table. - 01-15-2009 , 08:10 AM






This need not be done with DTS or SSIS, specifically. You might be able to
set up a linked server to your Active Directory catalog, or even an OPENQUERY
method.

Try this for the linked server:
********************* START ***********
sp_addLinkedServer
'ADSI',
'Active Directory Service Interfaces',
'ADSDSOObject',
'adsdatasource'

EXEC master.dbo.sp_addlinkedsrvlogin
@rmtsrvname = N'ADSI',
@locallogin = NULL ,
@useself = N'False',
@rmtuser = N''

*************** END ******************
Or try this OPENQUERY method:

************** START ***************
SELECT *
FROM OPENQUERY
(ADSI,
'SELECT
name,
title,
givenName,
sn,
mail,
department,
telephoneNumber,
homePhone,
mobile,
streetAddress,
lastLogonTimestamp
FROM ''LDAP://<YourDomainHere>.com''
WHERE objectCategory = ''Person''
'
)
*************** END ****************

No guarantees for success as AD Security might block you out.

Good Luck.
--
Todd C

[If this response was helpful, please indicate by clicking the appropriate
answer at the bottom]


"Gunna" wrote:

Quote:
Hi there,

Im fairly green at SQL so need a little help. I have a simple table with 2
columns. One is called userID and the second is called fullname

I need some help getting my SQl server to connect to an Active directory
server and for all users export the userID and the fullname and put this nifo
into the table. Simple enough. Can anyone help me do this? Also can it be
made dynamic or at least scheduled to keep itself up to date?

Thanks.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.