If it really has to be Excel you could try the cool module by Doug Finke ImportExcel.
But actually I would recommend something else. What would be wrong with CSV files? You could create on file for each group. That would make using these data much easier than Excel files.
As Olaf stated, ImportExcel is awesome!
Something like this should work…
[pre]
| Get-ADGroup -Properties members |
foreach-Object -Begin {
$file = ‘c:\temp\Groups.xlsx’
} -Process {
$psitem.members | Export-Excel -Path $file -WorkSheetname $PSItem.Name
}
Wes’s script will get you most of the way there, you should also understand (and this is the case in every directory i’ve seen) that you will encounter nested ad groups.
instead of using get-adgroup, or get-adgroupmember, i would suggest the function from below. it will take a group as its input, and then generate a report of all objects that are a member of the group, and if the member is a group, it will gather those users as well