Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
select * from openquery(ADSI, ' select sAMAccountName, Name, distinguishedname, displayName, userAccountControlfrom ''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, userAccountControlfrom ''LDAP://DC=xxx,DC=COM'' where objectCategory = ''Group'' and member = ''CN=Joe,OU=City,OU=division,OU=divsision,DC=xxx,DC=com''')