Using PowerShell to find the MAPI endpoint on Exchange 2010

I’ve been working with some folks who are discovering the intricacies of MAPI on Exchange 2010. Since they were feeling some pain on this issue, I thought it may be worth writing about in case more folks are running into the same issue.

We’re used to Outlook doing a load of things for us, and quite automatically too in terms of finding and connecting to the correct mailbox, however when it comes to doing things programmatically the picture becomes slightly more complex. Bear in mind that the premise here is that were doing low level MAPI access and do not have autodiscover of any sort available to us.

So what’s the issue ?

When you’re connecting to a mailbox via MAPI, previous versions of Exchange could tell you where the mailbox was, either via PowerShell (Get-Mailbox) or via WMI (I did a guest post on the scripting blog which describes this concept at length) by querying the mailbox as to where it was hosted – that concept is relatively meaningless in Exchange 2010.

Let’s look at Exchange 2007 – Get-Mailbox returns a bunch of data which includes the mailbox, server, etc. Creating a MAPI connection on that basis  succeeds and life is great.


Exchange 2010 changes things somewhat, since the MAPI endpoint for mailboxes has moved to the CAS role, which may or may not not be installed on the same machine hosting the Mailbox Role OR the database in question.

So, Where to next?


[PS] C:\>get-mailbox Service_Mailbox | fl name, database

Name                         : Service_Mailbox

Database                     : R_DB


[PS] C:\>Get-MailboxDatabase "R_DB" | ft name, *rpc*

Name                                                        RpcClientAccessServer

—-                                                        ———————

R_DB                                                   EXCH01.EXAMPLE.COM

Thats a bit long winded, we can rewrite that in one or two lines of code as follows, assuming we know the name of the mailbox, and want to store the result in a variable called “$RPCclientaccessserver ”:

$RPCclientaccessserver = (get-mailboxdatabase((get-mailbox service_mailbox)

That nice one-liner is curtsey of Blog

So there we have it – if you’re writing software or scripting towards Exchange 2010 and you’re needing to figure out where the MAPI endpoint is for the mailbox in question, then this should help you out.

Nicolas Blank

Nicolas is an Architect, author, and speaker focused on all things Exchange and Cloud at NBConsult. With over 16 years of experience on Exchange, Nicolas consults to customers globally on cloud based and on-premises Exchange as well as ISVs building Exchange focused products. Nicolas has extensive experience using Azure to create public and private Azure based offerings leveraging cloud based principles and common sense. Nicolas currently holds status of MCM Exchange 2010, Office 365 (Microsoft Certified Master), MCSM Exchange 2013, and has been awarded Microsoft MVP (Most Valuable Professional) for Microsoft Exchange since March 2007. Nicolas has co-authored "Microsoft Exchange Server 2013: Design, Deploy and Deliver an Enterprise Messaging Solution," published by Sybex. Nicolas blogs regularly on Exchange and messaging topics at, tweets at @nicolasblank, and is the founder of and a contributor to IT Pro Africa and @itproafrica

nicolasblank has 99 posts and counting.See all posts by nicolasblank


Pin It on Pinterest