Here's what I've uncovered for using ADSI queries.  This is a view
that I've created to pull all current active directory users who are
'normal' and not 'disabled'.


ALTER VIEW valid_ad_users

AS

SELECT  name,sAMAccountName as username
FROM OpenQuery( ADSI,'<LDAP://DC=ACIG,DC=NET>;
                
(&(objectCategory=person)(objectClass=user)(!(userAccountControl:1.2.840.113556.1.4.803:=2))(!(userAccountControl:1.2.840.113556.1.4.803:=32))(userAccountControl:1.2.840.113556.1.4.803:=512));
name, sAMAccountName;subTree') a

order by name


On 2/22/06, Nick McClure <[EMAIL PROTECTED]> wrote:
> Sorry for the delay, I'm was trying to remember how it all worked :)
>
>
> First thing is first, you must add a linked server for ADSI. In Enterprise
> Manager, goto Security, then Right Click on Linked Servers and add a new
> one.
>
> Provider Name: OLE DB Provider for Microsoft Directory Serivces
> Product Name: Active Directory Services 2.5
> Data Source: adsdatasource
>
> Click on the security tab an click the bottom radio button: "Be made using
> this security context" and assign an Active Directory user that can read all
> of the AD, or at least the parts you want to query. You can work this stuff
> a little to suit your needs:
>
> Confirm all of that stuff.
>
> Then you query would look something like this:
> SELECT  [Name], sn AS [Last Name]
> FROM OPENQUERY( ADSI,
>      'SELECT name, sn, street, l, st
>       FROM ''GC:// DC=ad,DC=uky,DC=edu''
>       WHERE objectCategory=''Person'' AND
>       objectClass = ''contact''')
>
> Notice where it says ADSI, that is the name of the datasource you created
> above.
>
> One thing I found is that simply doing this still returns only 1000 records
> because it is still using the LDAP stuff. We re-mapped that somehow, but I
> cannot remember how we did that. I'm going through the code trying to
> remember. I'll pass that along once I figure it out.
>
--
"aeteti yeah, do you seeyea, ooohohohn neh I don wanta seh, yeh nah, I
don wanna seh", Pearl Jam, "Yellow Ledbetter"

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:5:197743
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/5
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:5
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.5
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to