Pages

Monday, March 7, 2016

Exchange Server Power Shell Commands Create, Disable, Enable & Export Mailbox


Today we are going to discuss about some commands of Exchange Server which are generally used. These commands can be executed in Power Shell or Exchange Server Management Shell. Each Command has been executed in Exchange Management Shell and an example of the same has been shown in images.

  1. Create a Mailbox Create new Mailbox using following command:
    Syntax
    New-Mailbox –userPrincipalName [new mailbox name]@[domain name]
    Example
    New-Mailbox –userPrincipalName abcdef@mailtest.com Then it will ask for new name & password. You can enter any name and assign any password.
    Name: AnyNewName Password: AnyNewPassword
    Now AnyNewName has associated with abcdef@mailtest.com. You can see the example of running command of “Exchange Management Shell” in fig 1. 
    Figure 1: New Mailbox Command Running in Exchange Management Shell
  2. Disable A Mailbox You can disable the created mailbox or any mailbox by using the following command:
    Syntax
    Disable-Mailbox –identity “[mailbox name]”
    Example
    Disable-Mailbox –identity “abcdef” abcdef is the mailbox name that has to be disabled.
    When you hit Enter button after writing this command then it will ask for confirmation about disabling the mailbox. While asking for confirmation on permission it will be displaying the consequences and chances to re-enable this mailbox. Before confirming, this action read the message carefully.
    Don’t disable any mailbox which is having remote archives because you cannot re-enable that mailbox which is having archive database. You can see the running command example in fig 2.
    Figure 2:  Disabling an Existing Mailbox Using Command
  3. Enable a Disabled Mailbox You can re-enable a disabled mailbox using following command in Exchange Management Shell & Power shell.
    Syntax
    Enable-Mailbox –identity “[Mailbox Name]”
    Example
    Enable-Mailbox –identity “abcdef” Here abcdef is a mailbox that has to be enabled.
    You can see the running Enable-Mailbox command example in fig 3 and you can verify by accessing mailbox using OWA (Outlook Web App) whether the enabled mailbox is working or not.
    Figure 3: Enable-Mailbox Command
  4. Export Mailbox Data You can Export any Mailbox data into Outlook PST file format by running following command in PowerShell or Exchange Management Shell.
    Syntax
    New-MailboxExportRequest –Mailbox [Mailbox Name] – FilePath “[Server Name]\[Shared Folder Name]\[New File Name].pst”
    Example
    New-MailboxExportRequest –Mailbox abcdef –FilePath “\\WIN8\pst\abcdef.pst” Here abcdef is the name of the mailbox to be exported.
    WIN8 is server name where I want to export mailbox data items.
    PST is the shared folder name, which is present inside WIN8 server.
    abcdef.pst is new PST file name that has to be created & stored mailbox data items inside this .pst file at the defined location.
    This command will work properly only if you have configured the shared folder and assigned all permissions to this folder. Otherwise go to configure & change permissions of Shared Folder.
    You can see the running example of Export mailbox data items command in fig 4.
    Figure 4: MailboxExportRequest Command
  5. Check Mailbox Export Request Status You can check the current status of running Export-Mailbox command by using this command which is defined following:
    Command
    Get-MailboxExportRequest | Get-MailboxExportRequestStatus You can see the running Export Mailbox Status command in fig 5.
    Figure 5: Mailbox Export Request Status

Conclusion

In this post, we discussed some PowerShell or Exchange Management Shell Commands, which are generally, used in Exchange Server. If you have any query related to Exchange Server Commands then you can write it in the comments section.
If you are unable to create mailbox in Exchange server then their might be the chance of corruption of Exchange mailbox database. Which you can easily fix the issue using Exchange Recovery Software.

0 comments:

Post a Comment

Post a reply