Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 [Resolved] Querying LDAP

Author  Topic 

snufse
Constraint Violating Yak Guru

469 Posts

Posted - 2011-02-17 : 07:51:22
Have following:

select  * 
from openquery(ADSI, '
select sAMAccountName, Name, distinguishedname, displayName, userAccountControl
from ''LDAP://DC=xxx,DC=COM''
where objectCategory = ''Group''')


Now I need to change query to show all groups a given person is member of. Thank you.

snufse
Constraint Violating Yak Guru

469 Posts

Posted - 2011-02-18 : 08:30:45
Got it working this way:

select  * 
from openquery(ADSI, '
select sAMAccountName, Name, distinguishedname, displayName, userAccountControl
from ''LDAP://DC=xxx,DC=COM''
where objectCategory = ''Group'' and member = ''CN=Joe,OU=City,OU=division,OU=divsision,DC=xxx,DC=com''')
Go to Top of Page
   

- Advertisement -