none
Syntax to disable mailbox

    Question

  • Hi Experts

    I want to disable mailbox for an office 365 user but the account in AD must be active, experts help me with powershell syntax. and also how can i check the mailbox status if its active or disabled.

    Wednesday, May 22, 2019 7:25 AM

All replies

  • Disable-Mailbox

    https://docs.microsoft.com/en-us/powershell/module/exchange/mailboxes/disable-mailbox?view=exchange-ps

    This disconnects the mailbox from the user account, which is what "disabling" a mailbox means in Exchange.  You can see if a mailbox is "disabled" by using Get-Mailbox "User Name" and seeing that no mailbox exists.

    If you mean that you want to leave the mailbox there but prevent it from receiving mail, that's harder.  You can remove the SMTP addresses, hide it from the address lists, set the send & receive quota to 0, etc.


    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
    Celebrating 20 years of providing Exchange peer support!


    Thursday, May 23, 2019 12:11 AM
    Moderator
  • Hi Roger,

    If you are running a hybrid environment, all user accounts locate in on-premise AD, and mailboxes locate in Exchange online, as Ed mentioned, you can use "disable-mailbox" cmdlet to disable mailbox:

    Disable-Mailbox UserName -PermanentlyDisable

    If you are running a cloud only environment, both user account and mailbox locate in Exchange online, you need to disable exchange online plan from the assigned license, as below:

    Office 365 EAC > Users > Active users > Select User > Product licenses > Edit > Turn off "Exchange online(Plan *)"

    You can also use powershell to disable this service plan, detail see :

    Office 365 Licensing – Enable / Disable Service Plans in PowerShell

    I have tested in my office 365, it works as expected:


    Best Regards,
    Niko Cheng


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Thursday, May 23, 2019 9:09 AM
    Moderator
  • I posted my original reply because you said "for an office 365 user" but now I realize you might mean that it's an on-premises AD user synchronized to the cloud.  In that case, the command you'd use would be Disable-RemoteMailbox in on-premises Exchange.

    https://docs.microsoft.com/en-us/powershell/module/exchange/federation-and-hybrid/disable-remotemailbox?view=exchange-ps

    All the rest of my answer still applies.

     

    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
    Celebrating 20 years of providing Exchange peer support!

    Thursday, May 23, 2019 7:17 PM
    Moderator
  • Hi Roger,

    I'm just writing to check how's everything going? If you have any questions or needed further help on this issue, please feel free to post back. If the issue has been resolved, please mark the helpful replies as answers, this will make answer searching in the forum easier and be beneficial to other community members as well.

    Thanks for your understanding.


    Best Regards,
    Niko Cheng


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Monday, June 3, 2019 9:20 AM
    Moderator