I would like to get a list of Active Directory groups and their members (users) based on a group description (text). It would be great if the output file would be in the format:
Group1 User1 User2 User3 Group2 User2 User3 Group3 User1 .....
So far I got to the list of groups that contains text that is in the description. I was not able to get members of these groups.
Get-Adgroup -Filter * - Properties Name, Description | Select Name, Description | Where-Object {$_.Description -eq "description-text"}
I did get a list of Groups (Name) and Description only containg Groups that have desired description. I tried to continue with | Get-AdGroupMember -Identity
but did not get anywhere.
Get-ADGroup -Prop Name,Members
, and then run each through aForEach-Object
loop that outputs first the name, then the members. – TheMadTechnicianSelect Name, Description
<<< says "throw away all the properties EXCEPT the ones listed" ... and theGet-ADGroupMember
cmdlet needs the identity info that you threw out. [grin] – Lee_Dailey