导出AD Group 中用户列表

Lepiaoxue2022-10-18技术文章341

For groups whose members are more than 1000, membership cannot be extracted using the command Get-ADGroupMember as it will show only 1000 results.

In such cases, you need to run the below command :

Get-ADGroup $group -Properties Member | Select-Object -Expand Member | Get-ADUser -Property Name, DisplayName

In $group you can give the name of the group (under double quotes)

By default this command will look up for the group under A domain and all users which are in A domain will show up.

Let’s say there are members from the other domain also, in that case you need to use one more switch

Get-ADGroup $group -Properties Member | Select-Object -Expand Member | Get-ADUser -server B.com -Property Name, DisplayName

OR

Get-ADGroup $group -Properties Member | Select-Object -Expand Member | Get-ADUser -server C.com -Property Name, DisplayName

Similarly, if your group is in domain other than A, you can use the same switch in first command like below : 

Get-ADGroup -server B.com $group -Properties Member | Select-Object -Expand Member | Get-ADUser -Property Name, DisplayName


版权归乐飘雪所有!

本文链接:http://lepiaoxue.com/post/3.html

标签: AD Group