【问题标题】:Move user to OU in Active Directory (Access is Denied Error)将用户移动到 Active Directory 中的 OU(访问被拒绝错误)
【发布时间】:2013-11-04 12:56:25
【问题描述】:

当我尝试将用户移动到 Active Directory 中的不同组织单位时,我收到 System.UnauthorizedAccessException {"Access is denied."} 错误。

下面是我正在使用的代码。调用MoveTo 时会引发错误。如果我注释掉对MoveTo 的调用,则在调用CommitChanges 时用户的电话号码更新成功,这表明这可能不是权限错误。

是否有人能够解释为什么我不能将用户移动到新的 OU?

        Try

        Using Entry As DirectoryEntry = GetDirectoryEntry(DomainLogin) 'Retrieves the directory entry for the user.

            Entry.Properties("telephoneNumber").Value = "9999999" 'This successfully changes the user's phone number

            Dim strUserPass As String() = nBase.oAppControl.GetADUsernameAndPassword()

            'Create DirectoryEntry for the target OU
            Dim newLocation As DirectoryEntry = New DirectoryEntry("LDAP://testgrp.local/OU=Accounts,DC=local", strUserPass(0), strUserPass(1))

            Entry.MoveTo(newLocation) 'Throws exception
            Entry.CommitChanges()


            Return True

        End Using

    Catch ex As Exception
        Return False

    End Try

【问题讨论】:

  • 您确定使用strUserPass 传递的凭据具有移动用户的权限吗?
  • 你能通过 GUI 移动用户吗?像 Active Directory 用户和计算机控制台?
  • 我明天会仔细检查权限并通过 Windows 尝试。 strUserPass 的凭据允许更改电话号码 - 是否有将用户移动到 OU 的单独权限?感谢您的回复
  • 我在尝试通过 GUI 移动时收到 Access is Denied,所以它一定是权限问题。有谁知道我需要哪些特定权限才能跨 OU 移动用户?

标签: .net vb.net active-directory


【解决方案1】:

虽然你的问题为时已晚,但对于那些有同样问题的人,正如我所检查的,在 OU 中移动用户的最低权限是 Account Operator 。 当然Enterprise AdminDomain Admin 有更多的特权。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-06-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-09-01
    • 1970-01-01
    相关资源
    最近更新 更多