Disconnected mailboxes and disconnected date

To display mailboxes that are disconnected use the following command.
Replace with the name of your mailbox server.
This gives a list of the disconnected mailboxes.
Get-MailboxStatistics -Server | where { $_.DisconnectDate -ne $null } | select DisplayName,DisconnectDate

To reconnect you use the command below
Connect-mailbox –database "mailbox database name" –Identity "disconnected mailbox name" –User "User to connect to"

Enable or Disable Circular Logging in Exchange 2010

Open Exchange Management Console
  1. In Organization Configuration click on Mailbox
  2. Tab Database Management
  3. Right click on the database
  4. Tab Maintenance
  5. Check “Enable circular logging”
PowerShell

Set-MailboxDatabase -CircularloggingEnabled:$true

Remember to re-disable it when done.

Set-MailboxDatabase -CircularloggingEnabled:$false

Exchange 2010: Which mailbox is linked to a specific email address?

If you want to find a email address that is used in the organisation but you don’t know the mailbox it is linked to.
This works for aliases to.

[PS] C:\Windows\system32>Get-Recipient random.email@company.com

Name                                                                    RecipientType
—-                                                                          ————-
Test User                                                              UserMailbox

 

Export all your Exchange email addresses to CSV

To create a list of all your email addresses including the primary and alias addresses run this PowerShell command;

Get-Mailbox -ResultSize Unlimited |Select-Object DisplayName,ServerName,PrimarySmtpAddress, @{Name=“EmailAddresses”;Expression={$_.EmailAddresses |Where-Object {$_.PrefixString -ceq “smtp”} | ForEach-Object {$_.SmtpAddress}}} | Export-CSV c:\smtp.csv -NoTypeInformation

Rebuild Exchange 2010 Search Index

A few times a year a user complains that searching trough his mailbox is not accurate.
Rebuilding the Exchange Search Index will usually solve this.

There is a default PowerShell script to reset the Search Index.
Open the Exchange Management Shell and navigate to %PROGRAMFILES%\Microsoft\Exchange Server\V14\Scripts and then run the following command:

.\ResetSearchIndex.ps1 -force -all

This will stop the MSExchangeSearch service and delete the catalog data for all mailstores.

More info over How to Rebuild the Full-Text Index Catalog in this technet article.

Handy Exchange Management Shell commands

Some Handy Exchange Management Shell commands I frequently use;

  • Enable auditing for all user mailboxes
    Get-Mailbox | Where-Object {$_.RecipientTypeDetails –eq “UserMailbox”} |Set-Mailbox -AuditDelegate Update,SoftDelete,HardDelete,SendAs,Create,FolderBind –Auditenabled $true
  • Get a list of all mailboxes on a Exchange server sorted on size.
    Get-MailboxStatistics -Server SERVERNAME | where {$_.ObjectClass –eq “Mailbox”} | Sort-Object TotalItemSize –Descending | ft @{label=”User”;expression={$_.DisplayName}},@{label=”Total Size (MB)”;expression={$_.TotalItemSize.Value.ToMB()}},@{label=”Items”;expression={$_.ItemCount}},@{label=”Storage Limit”;expression={$_.StorageLimitStatus}} -auto >>C:\Mailboxsize.txt
  • Delete disconnected mailboxes
    $mailboxes = Get-ExchangeServer | Where-Object {$_.IsMailboxServer –eq $true} | ForEach-Object { Get-MailboxStatistics –Server $_.Name | Where-Object {$_.DisconnectDate –notlike ‘’}} | select displayname, mailboxguid, database

    $mailboxes | ForEach { Remove-Mailbox -Database $_.Database -StoreMailboxIdentity $_.MailboxGuid -confirm:$false }
  • Import PST file into a mailbox into a root folder “Archive”
    New-MailboxImportRequest -FilePath \\uncshare\archive.pst -Mailbox MAILBOXNAME -TargetRootFolder "Archive"

Rebuild the Exchange 2010 Offline Address Book

Create a new Offline Address Book object

  1. Open the Exchange Management Console (EMC) and navigate to Organisation Configuration – Mailbox
  2. Click the Offline Address Book tab.  Right click in the blank area and click New Offline Address Book
  3. Give your OAB a different name than the existing one
  4. Select your Exchange 2010 MBX server as the OAB generation server
  5. Check Include the default Global Address Lists option
  6. Check Enable Web-based Distribution as well as the Enable public folder distribution option
  7. Finish the wizard

Restart Exchange Services

  1. Restart the Microsoft Exchange System Attendant service
  2. Restart the Microsoft Exchange File Distribution service

Update and set the OAB as default Offline Address Book

  1. Right-click your newly created OAB and click Update.  This can take a couple of minutes, confirm successful completion via your Application log
  2. Right-click the OAB from step 1 and and click Set as default

Assign the OAB to the affected users databases

  1. Open the Exchange Management Shell (EMS)
  2. Execute the following:
    Get-MailboxDatabase |  set-MailboxDatabase  -OfflineAddressBook “%your new OAB%”
  3. Wait for Outlook to complete it’s OAB download cycle (can be as much as 24 hours)

You can safely delete the old OAB once you’ve verified that your clients are successfully downloading the newly created one.