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.