This script will export a .CSV for each group in an OU. The CSV will be named the same as the group name.
Use this code on an Exchange Server:
Get-Group -OrganizationalUnit "Some OU" | ForEach-Object { Get-Group -Identity $_.Name | ForEach { $_.Members } | Get-User | Export-Csv ($_.Name + '.csv') }
Use this code on an machine with Import-Module ActiveDirectory loaded:
Get-ADGroup -OrganizationalUnit "Some OU" | ForEach-Object { Get-ADGroup -Identity $_.Name | ForEach { $_.Members } | Get-ADUser | Export-Csv ($_.Name + '.csv') }
* Greg Martin suggested I clear this up... Thanks!