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.
Hi All,I wanted to write a sql query to return all the users from a specific AD Group specifying the Group Name instead of the CN value in memberof.I have written the query as shown below. kIndly help me on the same :SELECT sAMAccountName as Login FROM OPENQUERY( ADSI, 'SELECT sAMAccountname FROM ''LDAP:// DC=<<MyDomainName>>,DC=com'' WHERE objectCategory=''person'' AND objectClass=''user'' AND memberOf=''CN=<<MyGroupName>>,OU=BI,OU=Administrator Accounts,OU=MIS,OU=Corporate Users,DC=<<MyDomainName>>,DC=com''')Kindly help me on the sameThanksrams