【发布时间】:2012-03-08 18:11:49
【问题描述】:
我正在使用
[System.DirectoryServices.AccountManagement.UserPrincipal]::FindByIdentity($context, $idtype, $sam)
如何将此用途转移到新的 OU?
我试过了:
...
$user_adspath = $user.Properties.adspath
$user_ou = [ADSI]"$user_adspath"
$user_ou.PSBase.MoveTo("LDAP://$target")
我收到“拒绝常规访问”错误。因为我需要权利。不过这行得通。
...
$user.description += " MOVED"
$user.Enabled = $False
$user.Save()
请记住,这是在没有 Quest、ADAM、Cmdlet 的非 2008 服务器上无法运行的。我唯一的工作是:
“Add-Type -AssemblyName System.DirectoryServices.AccountManagement”
我需要一些类似的东西:
$user.MoveTo("LDAP://$target")
$user.Save()
【问题讨论】:
标签: powershell