Connect to Exchange Online

On your local computer, open Windows PowerShell and run the following command –

$UserCredential = Get-Credential

In the Windows PowerShell Credential Request dialog box, type your Office 365 user name and password, and then click OK.

Run the following command –

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $UserCredential -Authentication Basic -AllowRedirection

Then run the command –

Import-PSSession $Session

You need to connect to the Microsoft Online Service for a number of operations. To do so run the following command using the credentials you input as above –

Connect-MsolService -Credential $UserCredential

Once you have finished with the session run the command –

Remove-PSSession $Session

OWA – Silent Redirection to Office365

If a user’s mailbox is in Office 365, the CAS server issues a redirect to Office 365 when the user has successfully authenticated. By default, it pops up a nuisance, interstitial page that requires an extra click (and can turn into a black hole),
This is avoided by adding the following code to C:/Program Files/Microsoft/Exchange Server/V14/ClientAccess/Owa/casredirect.aspx immediately above the line <!DOCTYPE HTML…

if (RedirectionUrl.Contains(“”)) {

You need to do this every time there is an update to the Exchange software.

Checking and De-listing Mailhubs Blacklisted by Hotmail/Live

Login at with a valid hotmail/live account. I have set up the account for this. Make sure you know the password (ask Clive McDowell).

Once you have logged in open another browser tab and go to The useful links are –

  1. View Data: summary report on host IP addresses with historical data going back possibly months.

  2. View IP Status: gives a list of any IPs that are blacklisted.

  3. Request Access: allows you to add IP addresses or address ranges to be included in the reporting.

The other links should be self-explanitory.

If one of the IPs is blacklisted go to this link and fill out the form. You will usually get an automated response fairly quickly but it’s really up to them how soon they take any action. In recent times it has only been a few hours.

Exchange 2010 Failed Database Content Indexes

Failed content indexes can easily go unnoticed when everything else is working fine however they will eventually begin to cause problems for you, for example by preventing database switch overs. You can list all failed indexes with the following command –

[PS] C:\>Get-MailboxDatabaseCopyStatus * | where {$_.ContentIndexState -eq “Failed”}

If any databases are listed the indexes can be fixed by piping the output from the command above into the Update-MailboxDatabaseCopy cmdlet as below –

[PS] C:\>Get-MailboxDatabaseCopyStatus * | where {$_.ContentIndexState -eq “Failed”} | Update-MailboxDatabaseCopy -CatalogOnly

Once this has completed run the first command again. It should not return anything if successful.

Message Tracking

Use EMS commands to retrieve message tracking data across several hub transport and mailbox server hosts as follows –

Get-ExchangeServer | where {$_.isHubTransportServer -eq $true -or $_.isMailboxServer -eq $true} |`
Get-MessageTrackingLog -sender "" -Start "7/28/2012 8:00AM" -End "7/28/2012 5:00PM"


This is a split one-line command so watch out for the trailing back-tick!

Check help on the Get-MessageTrackingLog commandlet for other switch options e.g. trawl for recipients, message ID etc.

From Pegasus to elsewhere

A user recently had the desire to move away from the email client they’d been using for some time, and had requested assistance. In this case, they were using a version of Pegasus (Version 4.6, I think). Vaguely recalling that you can import  data from various email clients to Thunderbird, I looked for a tool to convert the folders in the /Mail/ directory for Pegasus to something Thunderbird would use. Having read a little about it, I knew I needed to find a way to convert the folders to .mbx files, and found one called Mail System Converter here. It was then possible to move the folders and retain the email in a new client, or move it to an account on a server.

First install Thunderbird, and then add an IMAP account using your credentials. Having made sure this is connecting correctly, close down Thunderbird.

Using Mail System Convertor, you can use the ‘Folders’ menu, then select ‘Export from Pegasus’ to create files usable by Eudora. Having done so, simply move these .mbx files to:

C:\users\<yourusername>\AppData\Roaming\Thunderbird\Profiles\<random>.default\Mail\Local Folders\

Open Thunderbird again, and you can now see these as local folders. If you so wish, you can now drag them to your email account on your server.

Exim on Centos

The version of Exim that comes with rpmforge is currently 4.63 which is somewhat lower than the latest version. Rpms for the latest version (currently 4.77) is available from atrpms. Create the file /etc/yum.repos.d/atrpms.repo on any target machine and add the following content –

name=Centos $releasever – $basearch – ATrpms
includepkgs=libspf2* libsrs*

name=Centos $releasever – $basearch – ATrpms

To update exim simply run yum update exim

Adding Public Folder Permissions

The powershell command to add client permissions is –

Add-PublicFolderClientPermissions -Identity <PublicFolder> -User “Username” -AccessRights <Right>

You need to include a leading ‘\’ character in front of the public folder name. The following is a list of client user access rights:

  • ReadItems   The user has the right to read items within the specified public folder.
  • CreateItems   The user has the right to create items within the specified public folder and send e-mail messages to the public folder if it is mail-enabled.
  • EditOwnedItems   The user has the right to edit the items that the user owns in the specified public folder.
  • DeleteOwnedItems   The user has the right to delete items that the user owns in the specified public folder.
  • EditAllItems   The user has the right to edit all items in the specified public folder.
  • DeleteAllItems   The user has the right to delete all items in the specified public folder.
  • CreateSubfolders   The user has the right to create subfolders in the specified public folder.
  • FolderOwner   The user is the owner of the specified public folder. The user has the right to view and move the public folder, create subfolders, and set permissions for the folder. The user cannot read items, edit items, delete items, or create items.
  • FolderContact   The user is the contact for the specified public folder.
  • FolderVisible   The user can view the specified public folder, but cannot read or edit items within the specified public folder.

The only problem with this is that the command is not recursive i.e. if you set the permission for a top level folder for a user they will not be able to access any of the sub-folders. You have to resort to a script to set permissions recursively. The script is located in C:\Program Files\Microsoft\Exchange\Scripts and it is called AddUsersToPFRecursive.ps1. You can use it as in the following example –

.\AddUsersToPFRecursive.ps1 -TopPublicFolder “\MyFolder” -User “7654321” -Permission “PublishingEditor”

Strictly speaking you only need to include the double quotes if there is a space in any of the names.

Render Disconnected Mailboxes Visible in EMC

When you initially disable an Exchange 2007 mailbox it normally does not become visible in the EMC until after the administrative tasks have run overnight. You can speed this process up using the Clean-MailboxDatabase commandlet e.g.

C:>Clean-MailboxDatabase -Identity ex2k7-virt-1\v1sg1\v1sg1db

It may take a minute or two to appear in the disconnected mailbox list.