-
ADSI script in sql server with LDAP
Hi, I hope you can help me.
I'm working with active directory and I' m trying to take the users of a specified group.
I have no problems to take all the users of OU=IT MILANO but I must know the name and email of each users in a fixed group.
Example. The domain is:
bagella.com --> DC=bagella DC=COM
the name of the group is ITMILUSR and the name of the Organizzation Unit = IT MILANO
so I have created the follow string to take all the users of this group:
ADSI is my linked server.
SELECT * FROM OpenQuery(ADSI,'<LDAP://CN=ITMILUSR, OU=users, OU=IT MILANO,DC=Bagella,DC=COM>;(&(objectCategory=group) (objectclass=group));cn;subtree')
Where is the error???
many thanks for the help.
-
The syntax of openquery is
select * from openquery(ADSI,"Select column1,column2,column3 from tablename where condition)
example:
SELECT * FROM OPENQUERY(ADSI, 'SELECT displayName, department FROM
''LDAP://LBBGCServer1/ DC=mycorp,DC=xyz,DC=mygov,DC=us'' WHERE objectCategory =
''Personell'' AND objectClass
= ''user''')
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|