0

在 Active Directory 轻量级目录服务实例中,我有点卡住了以下命令:

try
{
New-AdObject -Server $ADLDSServer -Name $($person.CN) -OtherAttributes @{'ObjectSid' = $($ADUser.objectSID) } -Path "OU=users,dc=domain,dc=test" -Type CompanyPerson -Verbose -Instance $person
}

这是创建新对象并从目标域添加对象 ID 的脚本的一部分。这与过滤器 *一起使用,我只更改了一些参数来针对一位用户进行测试。

现在,我得到的错误如下:

VERBOSE: Performing the operation "New" on target "OU=users,dc=domain,dc=test".
WARNING: The modification was not permitted for security reasons
D:\scripts\ObjectSID.PS1 : The modification was not permitted for security reasons
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,UpdateObjectSID.PS1

我获得了此实例和文件夹的权限,所以我认为这不是权限问题。请问有谁熟悉这个问题并知道如何解决?

谢谢

4

1 回答 1

0

我终于解决了这个问题并找到了问题。我选择了系统配置用户时使用的相同对象类“CompanyPerson”。我们为这个脚本创建了一个新对象来工作。

New-ADObject [-Server <String>] [-Name] <String> [-OtherAttributes <Hashtable>]  [-Path <String>] [-Type] <New_Custom_User_Object> [-Instance <ADObject>] [-Verbose] <String>

一旦我将对象类更改为为此脚本创建的新对象类,它就允许我在创建新对象期间设置 objectSID。无法通过 Set-Object 设置该参数。它只能在对象创建时生成一次。

谢谢

于 2020-04-02T22:50:15.417 回答