错误:使用“1”参数调用“MoveTo”的异常:“服务器不愿意处理请求。”

时间:2012-10-05 04:37:41

标签: ou

我正在尝试编写一个脚本来移动AD 2008中的用户OU

$Alias = "hareeshvm"

# Finding the location of the user account harveesm:

$Root = [ADSI]("LDAP://DC=corp,DC=bharatpetroleum,DC=com")
$searcher = new-object System.DirectoryServices.DirectorySearcher($root)

$searcher.filter = "(&(objectClass=user)(mailNickName= $Alias))"

$User = $searcher.findone()

# Binding the user account to $AUser and the OU to move to to $MovetoOU
$ADSPath = $User.Properties.adspath


$MoveToOU = [ADSI]("LDAP://OU=Temp,DC=corp,DC=bharatpetroleum,DC=com")

$AUser = [ADSI]("$ADSPath")

执行实际行动的命令

$ AUser.PSBase.moveto($ MoveToOU)

我得到以下提到的错误

使用“1”参数调用“MoveTo”的异常:“服务器不愿意处理请求。 “ 在D:\ Ashish \ MS Exchange \ New User \ newuserscreation.ps1:39 char:21 + $ AUser.PSBase.moveto<<<< ($ MoveToOU)     + CategoryInfo:NotSpecified:(:) [],MethodInvocationException     + FullyQualifiedErrorId:DotNetMethodException

事先提前

0 个答案:

没有答案