【发布时间】:2023-03-05 03:13:01
【问题描述】:
我在 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
}
这是创建新对象并从目标域添加对象标识的脚本的一部分。这是与 filter * 一起使用的,我只更改了一些参数来针对一位用户进行测试。
现在,我得到的错误如下:
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
我获得了此实例和文件夹的权限,所以我认为这不是权限问题。请问有谁熟悉这个问题并知道如何解决?
谢谢
【问题讨论】:
-
您不能自己设置 objectSid 属性。该值由系统在创建帐户时设置。
-
您好 Theo,目前正在两个 AD LDS 实例之间的任务调度程序中工作。我的问题是运行修改后的脚本以从 AD 服务器检索信息/删除 AD LDS 实例中的广告对象/并使用从该 AD 获取的 objectSID 变量创建一个新的广告对象。我正在为单个用户运行它作为测试。
标签: powershell active-directory adlds