下面是我的脚本的输出:
Leave SECRETARY in Admin
New OU is LDAP://OU=Technology,OU=DomainComputers,DC=xxx,DC=d2g,DC=com
dest DN is OU=Technology,OU=DomainComputers,DC=xxx,DC=d2g,DC=com
from DN is CN=STUDENT100,OU=Private,OU=DomainComputers,DC=xxx,DC=d2g,DC=com
Move STUDENT100 from Private to Technology
error 80005000
Leave LAP6514H in Kiosk
Leave LAP6461H in Teachers这是有问题的代码。这是在从新目的地的数据库读取ou1的循环中,从AD读取相应计算机的ou2。
If ou1="" Then
wscript.echo "Leave",computername,"in",ou2
Else
If ou1<>ou2 Then
'move to right OU
newOU = "LDAP://OU=" & ou1 & ",OU=DomainComputers," & DCsuffix
wscript.echo "New OU is",newOU
Set objOU = GetObject(newOU)
wscript.echo "dest DN is",objOU.DistinguishedName
wscript.echo "from DN is",PCDN
Wscript.echo "Move",computername,"from",ou2,"to",ou1
On Error Resume next
objOU.MoveHere PCDN, vbNullString
If err.number<>0 then wscript.echo "error",Hex(err.number)
On Error GoTo 0
Set objOU = Nothing
End If
End If我在同一脚本中的其他地方有几乎相同的代码,可以使用obj.MoveHere成功地将用户移动到新的OU
我已经使用ADSI edit检查ou是否正确,输出显示新的ou存在。我已经检查了容器上的权限。我可以使用AD Users和computers MMC移动计算机。我以管理员身份在Win2012 R2 DC上运行该脚本。我试过另一个华盛顿。如果我删除了“On Error resume”,它会显示文本"Active Directory: An invalid directory pathname was passed“并停止。有人能指出我的错误吗?
Mar:我已经用完了可以尝试的东西。作为变通方法,我使用脚本(带有On Error...)要查看需要移动的内容,请使用AD MMC手动移动它们。如果能有更好的建议,我将不胜感激。是否有其他方法可以不使用LDAP来移动AD对象?
发布于 2015-02-22 17:47:03
//
// MessageId: E_ADS_BAD_PATHNAME
//
// MessageText:
//
// An invalid directory pathname was passed
//
#define E_ADS_BAD_PATHNAME _HRESULT_TYPEDEF_(0x80005000L)你的道路是错误的。
https://stackoverflow.com/questions/28654513
复制相似问题