I was advised to post here. I did post in VBScript.
Hi,
I'm trying to search for all users in AD and return enabled accounts and accounts that are not members of a particular group.
Here is the LDAP / SQL query.
As is, I get to records, however if I take out everything to the right of 'Person' it returns all accounts. I've tried the userAccountControl with the memberof and visa-versa. Still no luck.
If anyone can point out what is wrong, I'd be most grateful.
Many thanks
Woter.
Hi,
I'm trying to search for all users in AD and return enabled accounts and accounts that are not members of a particular group.
Here is the LDAP / SQL query.
Code:
objCommand.CommandText = _
"SELECT ADsPath FROM 'LDAP://dc=int,dc=mosaichomes,dc=co,dc=uk' WHERE objectCategory='Person' AND <> userAccountControl:1.2.840.113556.1.4.803:='2' AND <> memberOf='CN=GG_NOSHOWINPHONELIST,OU=Domain Global,OU=Groups,OU=ENTIRE ORG Test,DC=mydomain,DC=co,DC=uk'"
As is, I get to records, however if I take out everything to the right of 'Person' it returns all accounts. I've tried the userAccountControl with the memberof and visa-versa. Still no luck.
If anyone can point out what is wrong, I'd be most grateful.
Many thanks
Woter.