Trying to filter AD groups. I've got this that works:
SELECT name, distinguishedName
FROM OPENQUERY( ADSI,'SELECT name, distinguishedName
FROM ''LDAP://hhsc.org/DC=hhsc, DC=org''
WHERE objectCategory = ''group'' AND proxyAddresses=''*'' ')
ORDER BY name
It works but we've got email addresses in Security Groups, so I'm trying filter that with this:
SELECT name, distinguishedName
FROM OPENQUERY( ADSI,'SELECT name, distinguishedName
FROM ''LDAP://hhsc.org/DC=hhsc, DC=org''
WHERE objectCategory=''group'' AND groupType:1.2.840.113556.1.4.803:=''2147483648'' ')
ORDER BY name
It keeps throwing:
Msg 7321, Level 16, State 2, Line 1 An error occurred while preparing the query "SELECT name, distinguishedName FROM 'LDAP://hhsc.org/DC=hhsc, DC=org' WHERE objectCategory='group' & groupType:1.2.840.113556.1.4.803:='2147483648' " for execution against OLE DB provider "ADsDSOObject" for linked server "ADSI".
I suspect it's syntax in groupType, but it's got me beat.
FYI that identifier or whatever you call it for groupType works in a CFLDAP query that gives me just my Distribution Lists.
Been working on this off and on for awhile now, but am not making any progress.
Thanks in advance.
"groupType:1.2.840.113556.1.4.803:" = ...
Assuming that is the actual column name – Miguel-F