Disable Exchange 2013 Mailbox based on Primarysmtpaddress

Welcome Forums General PowerShell Q&A Disable Exchange 2013 Mailbox based on Primarysmtpaddress

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
1 year, 7 months ago.

  • Author
    Posts
  • #68412

    Participant
    Points: 0
    Rank: Member

    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

    Participant
    Points: 0
    Rank: Member

    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

      Participant
      Points: 0
      Rank: Member

      Hi Pepe,

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

The topic ‘Disable Exchange 2013 Mailbox based on Primarysmtpaddress’ is closed to new replies.