im trying to select all the users that has a login to their machine at school, and these people have to be in a certain group ,in active directory. But i cant do it. If i select only user it works fine, but as soon as i put memberof='groupname' it gave back nothing. This is what i got
Code:
CREATE view View1
AS
select sAMAccountname, [name], physicalDeliveryOfficeName, givenName, userPrincipalName, cn, sn, mail, adsPath from openquery
(
ADSI,'SELECT sAMAccountName, name, physicalDeliveryOfficeName, givenName, userPrincipalName, cn, sn, mail, adsPath
FROM ''LDAP://mydomain''
WHERE objclass = ''user'' and memberOf='mystudent''
')
Go
select * from view1 order by adspath
drop view view1
the code above returns no records.
if i take out memberof i got many records.
if i put in
then i got this error message
Server: Msg 7321, Level 16, State 2, Procedure View1, Line 3
An error occurred while preparing a query for execution against OLE DB provider 'ADSDSOObject'.
OLE DB error trace [OLE/DB Provider 'ADSDSOObject' ICommandPrepare::Prepare returned 0x80040e14].
can some on help me plz plz plz.