Hi @Rising Flight ,
Based on AshokM, this could export the success/error messages to a csv file:
Import-Csv C:\list.csv |
ForEach{
try {
Add-DistributionGroupMember -Identity dl1@contoso.com -Member $_.users -ErrorAction Stop
Write-Output "Added $_ to Group" | Out-file "c:\import.csv" -Append
}
catch [System.Exception]
{
Write-Output "$_" | Out-File "c:\error.csv" -Append
}
Finally
{
}}
Example:
Regards,
Lou
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.