Hi @Roger Roger ,
Welcome to the Microsoft Q&A platform!Your PowerShell syntax looks mostly correct for managing the "Send As" and "Send on Behalf of" permissions for unified groups and distribution lists. Here are some adjustments and confirmations:
For unified groups
Add send permissions:
Add-RecipientPermission -Identity "unifiedgroup1@contoso.com" -AccessRights SendAs -Trustee user1@contoso.com
Add send on behalf of permissions:
Set-UnifiedGroup -Identity "unifiedgroup1@contoso.com" -GrantSendOnBehalfTo user1@contoso.com
Remove send permissions:
Remove-RecipientPermission -Identity "unifiedgroup1@contoso.com" -AccessRights SendAs -Trustee user1@contoso.com -Confirm:$false
Remove send on behalf of permissions:
Set-UnifiedGroup -Identity "unifiedgroup1@contoso.com" -GrantSendOnBehalfTo @{Remove="user1@contoso.com"}
For distribution lists
Add send permissions:
Add-RecipientPermission -Identity "onlinedl1@contoso.com" -AccessRights SendAs -Trustee "user1@contoso.com"
Add the Send on BehalfTo permission:
Set-DistributionGroup -Identity "onlinedl1@contoso.com" -GrantSendOnBehalfTo user1@contoso.com
Remove the Send on BehalfTo permission:
Remove-RecipientPermission -Identity "onlinedl1@contoso.com" -AccessRights SendAs -Trustee "user1@contoso.com" -Confirm:$false
Remove the Send on BehalfTo permission:
Set-DistributionGroup -Identity "onlinedl1@contoso.com" -GrantSendOnBehalfTo @{Remove="user1@contoso.com"}
Please feel free to contact me for any updates. And if this helps, don't forget to mark it as an answer.
Best,
Jake Zhang