First of all, get the Quest ActiveRoles Server Commandlets here.
Then the following script should give you a start. I am using Excel to store the info, which you can save as a .csv file. Makes it a little easier with the looping and saving of values.
$a = New-Object -comobject Excel.Application
$a.visible = $True
$b = $a.Workbooks.Add()
$c = $b.Worksheets.Item(1)
$c.Cells.Item(1,1) = "Users and Groups Report"
$c.Cells.Item(1,2) = Get-Date
$c.Cells.Item(2,1) = "User"
$c.Cells.Item(2,2) = "Groups"
$d = $c.UsedRange
$d.Interior.ColorIndex = 19
$d.Font.ColorIndex = 11
$d.Font.Bold = $True
$d.Font.Size = 14
$introw = 3
$users = Get-QADUser -SizeLimit $howmanyusersdoIwanttoget
foreach ($user in $users)
$c.Cells.Item($introw,1) = $user.DisplayName
$groups = Get-QADGroup -ContainsMember $user
foreach ($group in $groups)
$c.Cells.Item($introw,2) = $group.CanonicalName
You should be able to tune this up to meet your exact needs hopefully.