Get-ADGroupMember成功完成时不会返回任何内容

我尝试列出AD中所有组中的所有成员,但是没有任何返回,尽pipe命令已成功完成。 它既不适用于指定的组DN,也不适用于sAMAccountName。

Get-ADGroupMember "sAMAccountName" -Recursive | select name 

见下面的输出: 在这里输入图像说明

如果查看dsa.msc中的成员,则会显示以下消息

 --------------------------- Active Directory Domain Services --------------------------- Some of the object names cannot be shown in their user-friendly form. This can happen if the object is from an external domain and that domain is not available to translate the object's name. --------------------------- OK --------------------------- 

这可以成为PowerShell不返回结果的原因吗? 有什么想法吗?

UPD:这似乎不是权限问题,因为dsquery确实返回组成员。

如果它们包含ForeignSecurityPrincipal对象,则在组上得到相同的结果。 由于这些显示为SID,因此它看起来像是一个DS查询会抛出Get-Adgroupmember cmdlet没有find的exception。

Get-ADGroupMember需要使用ADGroup对象,因此您需要检索ADGroup并将其传递到Get-ADGroupMember cmdlet中。

 Get-ADGroup "GROUP_NAME" | Get-ADGroupMember -Recursive | Select name 

试试这个

 Get-ADGroupMember -identity “GROUP NAME” | select name| Export-csv -path C:\test.csv -NoTypeInformation 

问候,UnMelc