locked
Remove member from AcceptMessagesOnlyFrom using power shell RRS feed

  • Question

  • I am using exchange 2010 SP2 and I have some disabled mailbox which is added to the" Message delivery restriction" accesspt messages only from. I need a power shell command to remove this mailbox from the list. Thanks.


    Wednesday, June 4, 2014 9:08 AM

Answers

  • This works:

    # the target mailbox
    $u1dn=(get-user TARGETMAILBOX).distinguishedname
    # the user to remove from authOrig on the target mailbox
    $u2dn=(get-user USERTOREMOVE).distinguishedname
    #
    $u1 = [ADSI]"LDAP://$u1dn"
    $u1.properties.authorig.Remove($u2dn)
    $u1.SetInfo()
    You'd have to modify it to work with more than one item at a time, but that shouldn't be difficult.


    --- Rich Matheisen MCSE&I, Exchange MVP

    Monday, June 9, 2014 4:20 PM

All replies

  • Hi,

    "I need a power shell command to remove this mailbox from the list. Thanks.", could you please explain it furthermore?

    From your description, you want to do some settings for disabled mailboxes. Based on my knowledge, I'm afraid that you can do that for disabled mailboxes.

    Here is my tests for your reference:

    1. Let amy01 only accept messages from amy01@nourd.com. And then use the following cmdlet to check which mailboxes are set message delivery restrictions only accept message from.

    Get-Mailbox -ResultSize unlimited | where {$_.AcceptMessagesOnlyFromSendersOrMembers -notlike "$null"}

    Amy01 is in the result.

    2. I disable amy01, and then run the above cmdlet, amy01 is not in the result even though I have configured that restriction.

    Since we can't get these message delivery restrictions information of disabled mailboxes on EMS, I think we can't configure these message delivery restrictions of disabled mailboxes on EMS.

    Thanks for your understanding.

    Best regards,


    Amy Wang
    TechNet Community Support

    • Proposed as answer by Amit Tank Thursday, June 5, 2014 4:30 PM
    Thursday, June 5, 2014 6:02 AM
    Moderator
  • yes, you are right I am trying to remove disabled mailbox from  the
    message delivery restrictions. I face this issue when I try to add new
    enabled mailbox to the message delivery restrictions ( only sender in
    the following list) and when I click apply it show that there is a
    disabled mailbox and cannot change. Check the attached file.

    Sunday, June 8, 2014 8:34 AM
  • This works:

    # the target mailbox
    $u1dn=(get-user TARGETMAILBOX).distinguishedname
    # the user to remove from authOrig on the target mailbox
    $u2dn=(get-user USERTOREMOVE).distinguishedname
    #
    $u1 = [ADSI]"LDAP://$u1dn"
    $u1.properties.authorig.Remove($u2dn)
    $u1.SetInfo()
    You'd have to modify it to work with more than one item at a time, but that shouldn't be difficult.


    --- Rich Matheisen MCSE&I, Exchange MVP

    Monday, June 9, 2014 4:20 PM
  • Is this script will remove all the disabled mailbox from the message delivery restriction. Or how it will work, could you please explain. Is this to be run from exchange power shell. thanks.
    Tuesday, June 10, 2014 12:41 PM
  • The little bit of code just demonstrates that it's possible to modify the authoring property by removing a distinguishedName from the multi-valued property. That bit of code does no error checking (e.g. whether the mailbox exists, the user to be removed exists, of if the modification was made successfully. Nor does it use any variables (the values are hard-coded).

    The example will NOT remove all the distinguishedNames of all users/contacts/groups that are not mail-enabled from the authOrig property, although that can be done.

    So, that being said, you must run the code in the Exchange Management Shell (it uses the get-mailbox and get-user cmdlets).

    The example gets the distinguished names of the mailbox to be modified and the distinguished name of the user to be removed from the authoring property. It then removes the distinguished name from the authOrig property on the mailbox and saves the modification.


    --- Rich Matheisen MCSE&I, Exchange MVP

    Tuesday, June 10, 2014 4:09 PM