$groups = gc H:\Groups.txt
Foreach ($group in $groups) {
Get-ADGroupMember -Identity $group | ft $group
}
这就是我一直在尝试的,但这只列出了用户,而不是他们所属的群组。
谢谢Alex
答案 0 :(得分:3)
未经测试,但这是你想要的事情:
$groups = gc H:\Groups.txt
$report = @()
Foreach ($group in $groups) {
Get-ADGroupMember -Identity $group | % {
$report += New-Object PSObject -Property @{
Group = $group
Name = $_.name
}
}
}
$report | ft -Autosize