While the Exchange Management Shell is a thing of wonder its not always available when your writing a script or piece of real code and you need to do something like finding your Exchange 2007/2010 CAS or Mailbox role servers. The good news is like most of the Exchange configuration information this is stored in Active directory and can be relatively easily queried using LDAP and ADSI. The AD property that holds this information about what particular roles are installed on a Exchange server is the msExchCurrentServerRoles property. This property contain a number of bitwise flags that indicate which roles are installed as per http://technet.microsoft.com/en-us/library/bb123496(EXCHG.80).aspx . Server role Role value Mailbox role 2 Client Access role (CAS) 4 Unified Messaging role 16 Hub Transport role 32 Edge Transport role 64 So to query these in ADSI we need to use a Bitwise filter as per http://support.micros
Pushing the Envelope in Messaging and Office 365 Development