Share via

How to add/remove allow sender of distribution group with powershell?

Anonymous
2023-08-14T13:01:38+00:00

Hello,

Please help me about how to add/remove allow sender of distribution group using Powershell?

I did find a few answers like the one below:

We need toconnect to Exchange online first in powershell. And here is the command to edit the allow list:

set the allow list users addresses:

Set-DistributionGroup "group name" –AcceptMessagesOnlyFrom @domain.com,******@domain.com

add the specific users to allow list:

Set-DistributionGroup "group name" –AcceptMessagesOnlyFrom @{add="@domain.com","@domain.com"}

remove the specific users to allow list:

Set-DistributionGroup "group name" –AcceptMessagesOnlyFrom @{remove="@domain.com","@domain.com"}

use the following command to check the allow list users:

Get-distributiongroup -identity "group name" | fl acceptmessagesonlyfrom

Reminder: we need to type "" in the command in powershell.

However, when I run the command, I get this error:

PS C:\WINDOWS\system32> Set-DistributionGroup "All Security Insurance" AcceptMessagesOnlyFrom @{add="******@xxxxxxxxx.com"}
Set-DistributionGroup : A positional parameter cannot be found that accepts argument 'AcceptMessagesOnlyFrom'.
At line:1 char:1

  • Set-DistributionGroup "All Security Insurance" AcceptMessagesOnlyFrom @{a ...
  •     + CategoryInfo          : InvalidArgument: (:) [Set-DistributionGroup], ParameterBindingException  
        + FullyQualifiedErrorId : PositionalParameterNotFound,Set-DistributionGroup
    
    

Btw, I use the standard Office 365 portal - it is not on-premises Office.

I would be grateful for your helo, please.

Thank you

Sebastian

Microsoft 365 and Office | Subscription, account, billing | For business | Other

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2023-08-14T14:27:40+00:00

    Dear Sebastian Galazka

    Good day! Thank you for posting to the Microsoft Community. We are happy to help you!

    First of all, we apologize for the trouble and inconvenience caused to your work! Based on your description, since we are focused on technical support for Microsoft 365 Business Exchange Online, which is not professional for your question, I recommend that you ask questions (based on) in Welcome to the Microsoft PowerShell Community. Technical engineers over there specialize in PowerShell issues, and experts will focus on queries to further assist you.

    Note: Since this is a public community, in order to protect your privacy, I need to code your personal information, thank you.

    Thank you in advance for your understanding! Your patience and cooperation will be greatly appreciated. Hope all the best!

    Sincerely

    Kerry Chen | Microsoft Community Moderator

    0 comments No comments