Exchange 2010 or 2013 Management Shell

Here are some simple Exchange Management Shell commands for a few common tasks I had encountered over the past several years. I like to have a quick web reference ‘sheet’ in case I need the information fast. These commands involve Exchange server 2010 but generally will work for 2013 as well. Focus is on: exporting mailbox to archive [.PST] and getting an update on the export; updating a Global address list quickly; removing a disconnected mailbox; working quotas and certificates, etc.

Export Mailboxes to PST sample:

–> New-MailboxExportRequest -Mailbox ExampleUser -FilePath “\\EXCH10ZZ-M\PSTs$\ExampleUser.pst”

–> Get-MailboxExportRequest | Get-MailboxExportRequestStatistics

–> Get-MailboxExportRequest | Remove-MailboxExportRequest

~~~~~~

To immediately update the GAL, go to the Exchange shell, and do the following (steps 2-4, step 1 MAY not be needed in some cases; it depends on the extent of the Active Directory set up):

1. AD Sites + Services: replicate AD to all DCs via NTDS etc. (ref. MS Technet)

2. Use PowerShell or Go to the EMC to manually update the OAB: in EMC: go to Organization Configuration/Mailbox/Offline Address Book then right click the address book as needed

3. Open Services.msc off the Exchange server > Restart the System Attendant Service

4. Shell > run: Update-FileDistributionService at command pipeline position 1

Supply values for the following parameters:

Identity: [Exchange Server name]

After the above, the GAL needs to be downloaded within Outlook – Send-Receive Groups/Full Details in each user’s Outlook to reflect changes, else shows within a few hours

~~~~~~~~~~~~~~~

Completely Remove a Disconnected mailbox [note mailboxes will usually clear out within several days, but if one or two are hanging around]:

In Exchange 2007 & 2010, there is no way to remove a disconnected mailbox in the console. We can use the “Remove-StoreMailbox” command to remove it in 2010. To remove a mailbox permanently:

Remove-StoreMailbox –database “MailDatabaseName” –identity “ExampleUser” –MailboxState Disabled

Finally, run:

Get-MailboxDatabase | Clean-MailDatbaseName to refresh the console.

More:

Get all Mailbox or DB Quota related info:

Get-Mailbox -Database Exch10ZZ-M | FL name,issuewarningquota,prohibitsendquota,prohibitsendrecievequota > c:\Temp\Quotas.txt

Get-MailboxDatabase -Server SERVERNAME | FL name,issuewarningquota,prohibitsendquota,prohibitsendrecievequota

get-mailbox -filter { usedatabasequotadefaults -eq $false -AND recipientTypeDetails -eq ‘usermailbox’ }

CAREFUL HERE:[sets quota

Get-Mailbox -Database DatabaseName | Set-Mailbox IssueWarningQuotasize

-UseDatabaseQuotaDefaults $boolean value

**** Track Mailbox Sizes!

i.e.

Get-Mailbox -database MailDatabaseName | Get-MailboxStatistics | Sort-Object TotalItemSize -descend | Select-Object DisplayName,ItemCount,@{name=”MailboxSize”;exp={$_.totalitemsize}}

~~~

Certificates:

Get-ExchangeCertificate | fl

Leave a Reply

Your email address will not be published. Required fields are marked *

62 − = 52