Created
October 24, 2012 11:04
-
-
Save booyaa/3945485 to your computer and use it in GitHub Desktop.
Query Active Directory using SQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT sAMAccountName | |
,Name | |
,userAccountControl | |
,givenName | |
,sn | |
FROM 'LDAP://DC=domain,DC=co,DC=uk' | |
WHERE sAMAccountType = 805306368 | |
AND userAccountControl = 512 | |
ORDER BY sAMAccountName ASC | |
-- Caveat: will only return 1000 results |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment