Import-Module ActiveDirectory
$userList = Get-Aduser -Filter *
foreach($user in $userlist)
{
[array]$userGroups = Add-ADPrincipalGroupMembership -Identity $user.samaccountname
$result = $user.samaccountname + "`t" + $user.displayName + "`t" + ($userGroups.name -join "; ")
Out-file -InputObject $result -FilePath "C:\result.csv" -Append # Если в файл вывод не нужен, то "Write-Host $result"
}