您好, 根据我的研究,建议可以尝试看看下面的脚本是否满足您的需要: Get-ADGroup -Filter * -SearchBase 'OU=Group,DC=gawcap,DC=com,DC=cn' | ForEach-Object { $groupName = $_.Name Get-ADGroupMember -Identity $groupName | Select-Object @{Name = 'GroupName'; Expression = {$groupName}}, Name | Group-Object GroupName | Select-Object @{Name = 'GroupName'; Expression = {$_.Name}}, @{Name = 'Members'; Expression = {($_.Group.Name | Out-String).Trim()}} } | Export-Csv -Path C:\membership.csv -NoTypeInformation 输出的CSV文件如下图: 如果需要修改脚本,请随时通知我。 此致 Albert Please remember to mark the replies as an answers if they help. |
|
来自: xiaozhuang > 《域控相关》