【发布时间】:2018-11-10 06:02:42
【问题描述】:
我们在 2 个森林之间有(2 路)信任关系:
- acme.com
- someOtherForest.com
我们在 Forest acme.com 中有几个子域
- domain1.acme.com
- domain2.acme.com
我在 domain1.acme.com 中有(嵌套)组,其中包含 domain2.acme.com 中的用户和 someOtherForest.com 中的 foreignSecurityPrincipals。
我连接的服务器使用 domain1.acme.com 上的 DC (dc1)。
我一直在使用以下脚本来输出给定组中的所有成员(递归)。它输出 foreignSecurityPrincipals 以及 domain1 用户非常好,但来自 domain2 的成员出错:
$Groups = Get-ADGroup -Properties * -Filter * -SearchBase "CN=app-users,OU=app,DC=domain1,DC=acme,DC=com"
Foreach($G In $Groups) {
$members = Get-ADGroupMember $G -recursive | Get-ADUser -Properties Mail |Select-Object DistinguishedName,sAMAccountName, Mail |
Export-CSV -Path C:\output.csv -NoTypeInformation
}
如果我将-server dc1:3268(DC 的 GC)添加到 Get-AdUser 部分,则 domain2 成员输出正常,但在 foreignSecurityPrincipals 上出错。
有没有办法从 acme.com 的所有子域中同时输出 foreignSecurityPrincipals 和成员?
【问题讨论】:
标签: powershell active-directory