Sunday, 28 February 2021

How to get Multiple Group member list with Group Description and user Properties

 How to get Multiple Group member list with Group Description and user Properties


File Format









$groups = Get-Content C:\Users\Administrator\Desktop\grouplist.txt

$results =foreach($group in $groups){

    Get-ADGroupMember $group | Get-ADUser -Property * | Select Name,mail,  @{n='GroupName';e={$group}}, @{n='Description';e={(Get-ADGroup $group -Properties description).description}}

}

 $results

 

$results | Export-csv C:\Users\Administrator\Desktop\grouplistresult.txt -NoTypeInformation 



No comments:

Post a Comment