SQL查询的禁用的Active Directory帐户 [英] SQL Query for Disabled Active Directory Accounts
本文介绍了SQL查询的禁用的Active Directory帐户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要查询AD以确定是否一个用户帐户被禁用。
使用的答案中使用类似的查询<一href="http://stackoverflow.com/questions/1251038/querying-active-directory-from-sql-server-2005">here
SELECT *
FROM OPENQUERY(ADSI,选择sAMAccountName赋
从''的LDAP:// DC = MYDC,DC = COM,DC =英国''
WHERE objectCategory属性=''人''
和objectclass =''用户'')
我相信,以确定是否被禁用的帐户我必须以某种方式使用userAccountControl的领域。我试了几件事情,但他们似乎并不奏效:
,其中userAccountControl的&放大器; 2';&GT; 0
解决方案
显然,它的工作......这将是一个ID-10-T:P
I need to query AD to determine if a users account is disabled.
Using a similar query used in the answers here
SELECT *
FROM OPENQUERY(ADSI, 'SELECT sAMAccountName
FROM ''LDAP://DC=MyDC,DC=com,DC=uk''
WHERE objectCategory = ''Person''
AND objectClass = ''user'')
I believe to determine if an account is disabled I have to use the userAccountControl field somehow. I've tried several things but they don't seem to be working:
WHERE userAccountControl & 2 <> 0
解决方案
Apparently it did work... this would be an ID-10-T :p
这篇关于SQL查询的禁用的Active Directory帐户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文