Disable Exchange 2013 Mailbox based on Primarysmtpaddress

This topic contains 2 replies, has 2 voices, and was last updated by Profile photo of Shashank Patinge Shashank Patinge 1 week, 6 days ago.

  • Author
    Posts
  • #68412
    Profile photo of Shashank Patinge
    Shashank Patinge
    Participant

    Hi,

    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
    Profile photo of pepe
    pepe
    Participant

    Hi,

    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
      Profile photo of Shashank Patinge
      Shashank Patinge
      Participant

      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.