java ad帐号禁用_如何使用LDAP请求启用或禁用AD用户帐户?(How can I enable or disable an AD user account with an LDAP reque...

如何使用LDAP请求启用或禁用AD用户帐户?(How can I enable or disable an AD user account with an LDAP request?)

到目前为止,我能够在LDAP中找到用户,但我不知道如何启用或禁用它们。

作为第二个问题,如果我的帐户具有域管理员权限,我将能够启用或禁用LDAP帐户吗?

注意:这是关于在Windows 2003上运行的Microsoft Active Directory。

我知道我可以检查有效用途 :

(!(useraccountcontrol:1.2.840.113556.1.4.803:=2))

残疾人使用:

(useraccountcontrol:1.2.840.113556.1.4.803:=2)

问题是如何设置属性,使其不会丢失其他二进制标志。

So far I was able to find users in LDAP but I don't know how can I enable or disable them.

As a second question, if my account has Domain Admin rights, I will be able to enable or disable account from LDAP or not?

Note: This is about a Microsoft Active Directory running on Windows 2003.

I know that I can check active uses with:

(!(useraccountcontrol:1.2.840.113556.1.4.803:=2))

Disabled useds:

(useraccountcontrol:1.2.840.113556.1.4.803:=2)

The question is how do I set the attribute in such way that it will not loose other binary flags inside.

原文:https://stackoverflow.com/questions/10053269

2020-02-23 18:55

满意答案

你需要在这里使用一些逻辑。 因此,要禁用用户,请设置禁用位(2)。 所以:

const long ADS_UF_ACCOUNTDISABLE = 0x00000002;

long userAccountControl = //currentUacValue

long newUserAccountControl = (userAccountControl | ADS_UF_ACCOUNTDISABLE);

要启用帐户,我们需要清除禁用位:

long userAccountControl = //currentUacValue

long newUserAccountControl = (userAccountControl & ~ADS_UF_ACCOUNTDISABLE)

You need to use a bit of logic here. So to disable a user, you set the disable bit (2). So:

const long ADS_UF_ACCOUNTDISABLE = 0x00000002;

long userAccountControl = //currentUacValue

long newUserAccountControl = (userAccountControl | ADS_UF_ACCOUNTDISABLE);

To enable an account, we need to clear the disable bit:

long userAccountControl = //currentUacValue

long newUserAccountControl = (userAccountControl & ~ADS_UF_ACCOUNTDISABLE)

2012-04-08

相关问答

您必须为ldap_modify提供要更改的帐户的可分辨名称(DN)。 没有办法解决这个问题。 如果您刚开始只知道sAMAccountName,那么您可以先在域中搜索该帐户,然后从结果中获取distinguishedName属性。 要搜索,请使用过滤器“(sAMAccountName = username)”使用ldap_search You have to give ldap_modify the distinguished name (DN) of the account you want to...

您可以调用Bind()方法来测试基本连接,而不是执行搜索,如下所示: ldapconn.Bind();

但是我不知道在没有try / catch的情况下测试它的方法。 Instead of performing a search, you could call the Bind() method to test basic connectivity like so: ldapconn.Bind();

However I don't know a way to test this without...

错误0000052D是系统错误代码 。 具体来说,它意味着: ERROR_PASSWORD_RESTRICTION 1325(0x52D) 无法更新密码。 为新密码提供的值不符合域的长度,复杂性或历史记录要求。 问题似乎是您启用的帐户应用了密码策略,从而使其无法满足密码策略。 我首先要弄清楚该帐户的密码策略是什么,然后在翻转该位以启用它之前将密码设置为符合该策略条件的密码。 但是,如果您确实希望用户能够在没有密码的情况下登录,则应将密码设置为null。 但我不确定在什么情况下这是可取的。 The ...

这些日期可能需要作为[datetime] / date进行投放,以便对$a的数学运算起作用。 最有可能将它们视为字符串,只是按字母顺序进行比较。 PS C:\Users\mcameron> "b" -gt "a"

True

如果没有样本日期,无法告诉您具体做什么,以便我们可以看到格式。 从评论中,如果您的日期格式为“2/8/2015”,那么简单的演员会解决这个问题。 PS C:\Users\mcameron> [datetime]"2/8/2015"

Sunday, February 08, 2...

使用过滤器根据您的条件进行过滤。 此代码段获取已禁用帐户的用户对象,然后过滤掉不到一周的帐户。 它将它们存储在用户对象的集合中。 您可以使用$variable | $variable where { [filter] }按任何用户对象属性进一步过滤$ userlist $variable | $variable where { [filter] }格式。 过滤器可以根据需要复杂化。 我喜欢在每一行上放一个,所以我可以轻松地评论出给定的过滤器。 将过滤后的列表用于您想要的任何内容。 $WeekAgo...

您可能可以查看在Active Directory中使用JAVA代码,特别是创建新用户和揭开userAccountControl的神秘面纱 对我来说,你忘记了“ CN ”属性。 You perhaps can have a look to Using JAVA code with Active Directory especialy Creating new users & demystifying userAccountControl For me you forgot the "CN" attr...

最后......我必须使用samAccountName而不是CN。 我希望它能帮到你们所有人。 多谢你们。 Finally... I must to use samAccountName instead of CN. I hope it help you all. Thanks guys.

你需要在这里使用一些逻辑。 因此,要禁用用户,请设置禁用位(2)。 所以: const long ADS_UF_ACCOUNTDISABLE = 0x00000002;

long userAccountControl = //currentUacValue

long newUserAccountControl = (userAccountControl | ADS_UF_ACCOUNTDISABLE);

要启用帐户,我们需要清除禁用位: long userAccountControl = //c...

密码未正确编码时可能会出现此错误。 确保它是Base64编码的UTF-16LE字符串。 示例(如果您使用的是Oracle JVM) String pass = "password";

sun.misc.BASE64Encoder enc = new sun.misc.BASE64Encoder();

String encoded = enc.encode(pass.getBytes("UTF-16LE"));

更新1:您是否尝试在没有userAccountControl属性的情况下运行代码(为了...

如果你这样做,我找到了答案 (userAccountControl & 2) != 0) // disabled

found the answer if you do a bitwise (userAccountControl & 2) != 0) // disabled

相关文章

Open [Tomcat install dir]\tomcat-users.xmlfor editi

...

官方文档里面说得比较明白,schema是数据对象的集合,包括像表、视图、索引、同义词等等都可以说是sc

...

最近在学Extjs,照着视频做了一个提交数据并且添加store的demo,却遇到一个奇怪的问题:添加第

...

“Aschemaisacollectionofdatabaseobjects.Aschemaisown

...

经过将近一天的努力,终于搞定了Solr的Data Import Request HandlerSche

...

微信公众平台开发 微信公众平台开发者 微信公众平台开发模式 微信浏览器HTTP_USER_AGENT

...

1. 数据完整性:任何语言对IO的操作都要保持其数据的完整性。Hadoop当然希望数据在存储和处理中不

...

在微信公众平台的开发过程中,我们有时需要开发网页并判断是否是是来自微信浏览器访问,本文介绍如何做出这一

...

记不起来是哪次看到有一个这样子的讲法,从POJO中再进行一次抽象,如从User中再使用Abstract

...

最新问答

如果启用了复制处理程序,请确保将其置于其中一个安全角色之后。 我见过人们做的另一件事是在不同的端口上运行admin。 最好在需要auth的页面上使用SSL,这样你就不会发送明确的密码,因此管理和复制将发生在8443上,而常规查询将在8080上发生。 如果您要签署自己的证书,请查看此有用的SO页面: 如何在特定连接上使用不同的证书? I didn't know that /admin was the context for SOLR admin because /admin does not re

第一:在您的样本中,您有: 但是你在询问 //td[@class=‘CarMiniProfile-TableHeader’] (注意TableHeader中的大写'T')。 xpath区分大小写。 第二:通过查询// td [@ class ='CarMiniProfile-TableHeader'] / td,你暗示你在外部td中有一个'td'元素,而它们是兄弟姐妹。 有很多方法可以在这里获得制作和模型

这是你的答案: http://jsfiddle.net/gPsdk/40/ .preloader-container { position: absolute; top: 0px; right: 0px; bottom: 0px; left: 0px; background: #FFFFFF; z-index: 5; opacity: 1; -webkit-transition: all 500ms ease-out;

问题是,在启用Outlook库引用的情况下, olMailItem是一个保留常量,我认为当您将Dim olMailItem as Outlook.MailItem ,这不是问题,但是尝试设置变量会导致问题。 以下是完整的解释: 您已将olMailItem声明为对象变量。 在赋值语句的右侧,在将其值设置为对象的实例之前,您将引用此Object 。 这基本上是一个递归错误,因为你有对象试图自己分配自己。 还有另一个潜在的错误,如果之前已经分配了olMailItem ,这个语句会引发另一个错误(可能是

我建议使用wireshark http://www.wireshark.org/通过记录(“捕获”)设备可以看到的网络流量副本来“监听”网络上发生的对话。 当您开始捕获时,数据量似乎过大,但如果您能够发现任何看起来像您的SOAP消息的片段(应该很容易发现),那么您可以通过右键单击并选择来快速过滤到该对话'关注TCP Stream'。 然后,您可以在弹出窗口中查看您编写的SOAP服务与Silverlight客户端之间的整个对话。 如果一切正常,请关闭弹出窗口。 作为一个额外的好处,wireshar

Android默认情况下不提供TextView的合理结果。 您可以使用以下库并实现适当的aligntment。 https://github.com/navabi/JustifiedTextView Android Does not provide Justified aligntment of TextView By default. You can use following library and achieve proper aligntment. https://github.com/

你的代码适合我: class apples { public static void main(String args[]) { System.out.println("Hello World!"); } } 我将它下载到c:\ temp \ apples.java。 以下是我编译和运行的方式: C:\temp>javac -cp . apples.java C:\temp>dir apples Volume in drive C is HP_PAV

12个十六进制数字(带前导0x)表示48位。 那是256 TB的虚拟地址空间。 在AMD64上阅读wiki(我假设你在上面,对吗?)架构http://en.wikipedia.org/wiki/X86-64 12 hex digits (with leading 0x) mean 48 bits. That is 256 TB of virtual address space. Read wiki on AMD64 (I assume that you are on it, right?) ar

这将取决于你想要的。 对象有两种属性:类属性和实例属性。 类属性 类属性对于类的每个实例都是相同的对象。 class MyClass: class_attribute = [] 这里已经为类定义了MyClass.class_attribute ,您可以使用它。 如果您创建MyClass实例,则每个实例都可以访问相同的class_attribute 。 实例属性 instance属性仅在创建实例时可用,并且对于类的每个实例都是唯一的。 您只能在实例上使用它们。 在方法__init__中定

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值