我正尝试使用dsget检索有关活动目录组成员的信息。 该命令检索一些但不是全部成员(141中的53)。 问题组包含一个子组。 与其他组没有子组相同的命令语法是成功的。 dsget的文档使清楚查询子组预计将工作。
dsget group "CN=MyGroup,OU=Users and Groups,DC=example,DC=ca" -members -expand -c | dsget user -samid -display dsget failed:CN=SomeChildGroup,OU=Users and Groups,DC=example,DC=ca:The object class of the target does not match the one specified on the command line. type dsget /? for help. samid display dandithe Danny.Dithers adamaca Adam.Abacus sarahso Sarah.Soother colcust Colin.Custard
这是从没有任何域pipe理员权限的用户帐户在客户端工作站(win7)上运行的。 为recursion查询子组添加或删除-expand参数似乎没有效果。 -c也不会继续出错。
任何想法是什么错误,如何解决它? 请记住我没有网域权限。
我发现我把-c放在pipe道的错误的一边。 或者也许应该是双方。 无论如何将其添加到正确的作品:
set ad_path=CN=MyGroup,OU=Users and Groups,DC=example,DC=ca dsget group "%ad_path%" -members -expand -c | dsget user -samid -display -c
仍然有一个错误,因为子组不是一个用户,但它通过并继续前进。
解答发现感谢理查Parmiter 。
问题是,来自dsget group某些对象实际上是组,但是您将它们全部传递给dsget user 。
解决这个问题的简单方法是将第一个命令的结果发送到文件,编辑组条目并将结果反馈给第二个命令。