Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query Active Directory 1

Status
Not open for further replies.

cs2009

Programmer
Aug 10, 2009
50
US
I found this vbscript snippet that queries active directory for users whose "Password never expires" is checked. How do I change the query to return those users whose "Password never expires" is "Unchecked"?

Code:
objCommand.CommandText = _
    "<LDAP://dc=c-sgroup,dc=com>;" & _
        "(&(objectCategory=User)(userAccountControl:1.2.840.113556.1.4.803:=65536));" & _
            "Name;Subtree"

Thanks
 
Got it figured out. should be:

Code:
objCommand.CommandText = "<LDAP://dc=c-sgroup,dc=com>;" & "(&(objectCategory=User)([b]![/b]userAccountControl:1.2.840.113556.1.4.803:=65536));" & "Name;Subtree"

The exclamation mark (!) before userAccountControl.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top