Import Active Directory Users to MSSQL


  1. Create a Linked Server in MSSQL Database  .
  2. Assume that linked server name is ADSI, take the properties of the linked server (ADSI) and edit the Security options.
  3. mssql-1
  4. mssql-2
  5. Use the below script for Import data from AD.
  6. SELECT * FROM OpenQuery (
    ADSI,
    ‘SELECT displayName, telephoneNumber, mail, mobile, facsimileTelephoneNumber
    FROM ”LDAP://epillars.local/DC=epillars,DC=local”
    WHERE objectClass = ”User”
    ‘) AS tblADSI
    ORDER BY displayname
Advertisements

2 comments

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s