Disable Exchange 2013 Mailbox based on Primarysmtpaddress

This topic contains 2 replies, has 2 voices, and was last updated by  Shashank 1 year, 1 month ago.

  • Author
  • #68412



    I am trying to create a script which will disable mailbox in Exchange 2013 based on Primarysmtpaddress.

    I can disable users with the below script:
    import-csv "D:\Script\Disable Mailbox\MBXDisable.csv" | foreach {Disable-Mailbox $_.Mailbox -confirm:$false}

    But the problem with the above script is if we add an alias to another mailbox , it would disable the other mailbox too.
    For Example:
    User 1 has domain ID : ABC and Email ID : ABC@test.com
    User 2 has domain ID: XYZ and Email ID: XYZ@test.com
    User 1 Exchange Mailbox gets disabled and an alias ABC@test.com is added to XYZ@test.com
    Now the challenge is if we run the above script, it would disable the mailbox for User 2.

    Let me know if I can get some help.

  • #68433



    PrimarySTMP / proxyaddresses must be unique if not you will get duplicate recipients on your exchange environment, for such kind of modifications if your Mailbox alias doesn't user some standardarized naming convention do a dump of the mailboxes and user the mailboxGUID since this will be unique value.

    as your command looks fine if the column "Mailbox" exists and if you use standard delimiter on the CSV.

    • #68436


      Hi Pepe,

      MailboxGUID will return the same GUID of the same mailbox to which the alias is added.

You must be logged in to reply to this topic.