Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

list members and properties from multiple AD groups

$
0
0

Hi - I need to create a csv that lists the members from multiple AD groups and for each member shows their displayname, username, distinquished name etc

So far I've got a script that lists members for each group:

$Groups = Get-ADGroup -Properties * -Filter * -SearchBase <path to OU>
Foreach($G In $Groups)
{
    Write-Host $G.Name
    Write-Host "-------------"
    $G.Members
}

But how do I modify this to display the properties for each user and also output to a csv?

Any help much appreciated

J

 

Viewing all articles
Browse latest Browse all 21975

Trending Articles