extracting user information from Active Directory

  • I have seen lots of discussions on this and  confused. i am working in a windows 2000 machine. I want to extract all user information from active directory. i have executed following queries.

    EXEC sp_addlinkedserver @server = 'ADSI', @provider = 'Active Directory Services 2.5',@srvproduct = 'ADSDSOObject',@datasrc = '[MachineName.corp.CompanyName.net]'

    go

    select * from openquery(ADSI, 'SELECT * FROM "LDAP://ExchageServerName/cn=Users,DC=CompanyName,DC=net')

    go

    Now it gives me following message

    Server: Msg 7403, Level 16, State 1, Line 1Could not locate registry entry for OLE DB provider 'Active Directory Services 2.5'.OLE DB error trace [Non-interface error: Provider not registered.].

    I have seen the Registry of this machine, latest version of ADSI is installed.

    Can any one have solution to this ? Thanks in advance for solution

     

  • I'm doing it like that, without linked server:

    create view _v_ADS_Contacts as

    SELECT *

    FROM OPENROWSET(

    'AdsDsoObject'

    ,'User ID=;Password=;ADSI Flag=0x11;Page Size=10000'

    ,'SELECT Name, givenName, SN, Mail, telephoneNumber, mobile, sAMAccountName, userPrincipalName

    FROM ''LDAP://OU=xxx,DC=xxx,DC=xxx,DC=de''

    WHERE objectClass = ''organizationalPerson''

    AND mail = ''*''

    '

    )

    Best regards
    karl

  • Here is a trick for OLE DB connection string testing:

    On your SQL Server, create a File called Test.udl, double-click this file to open the Data Link Properties window

    On the Provider tab, select the OLE DB provider

     In your case you are looking for "OLE DB Provider for Microsoft Directory Services"

    On the Connection tab, enter Data Source: "User ID=;Password=;ADSI Flag=0x11;Page Size=10000" without quotes (from Karl's example)

    Choose the Test Connection button to make sure you have the informaion correct

    Choose OK

    Open the Test.UDL file in Notepad, and look at the OLE DB Connection string that the Data Link Properties UI created.

    Andy

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply