Note on setting up new address books at the bottom of the page
ABPs contain:
One Global Address List
One Offline Address Book
One Room list
One or more Address Lists
Below is an example of the Central ABP setup from April 2020:
Name | GlobalAddressList | AddressLists |
ABP_AVA&IPS | \GAL_AVA&IPS | {\AL_IPS_Contacts, \AL_IPS_DGs, \AL_AVA_Contacts, \AL_AVA_DGs} |
ABP_TPT | \GAL_TPT | {\AL_TPT_Contacts, \AL_TPT_DGs} |
ABP_Central | \Default Global Address List | {\AL_IPS_Contacts, \AL_IPS_DGs, \AL_TPT_Contacts, \AL_AVA_Contacts, \AL_AVA_DGs, \AL_TPT_DGs} |
ABP_Gov | \GAL_Gov | {\AL_Gov_DGs}
|
The first column are the ABPs themselves, there is one for Arrow Vale & Ipsley, one for Tipton and one for Central, the second column are the global address lists which are below:
Name | RecipientFilter |
GAL_TPT | ((CustomAttribute15 -eq 'TPT_ABP') -or (CustomAttribute15 -eq 'Central_ABP')) |
GAL_AVA&IPS | ((((CustomAttribute15 -eq 'AVA_ABP') -or (CustomAttribute15 -eq 'Central_ABP'))) -or (CustomAttribute15 -eq 'IPS_ABP')) |
GAL_Gov | ((CustomAttribute15 -eq 'GOV_ABP') -or (CustomAttribute15 -eq 'Central_ABP')) |
Default Global Address List | (Alias -ne $null -and (ObjectClass -eq 'user' -or ObjectClass -eq 'contact' -or ObjectClass -eq 'msExchSystemMailbox' -or ObjectClass -eq 'msExchDynamicDistributionList' -or ObjectClass -eq 'group' -or ObjectClass -eq 'publicFolder')) |
The Default Global Address List is automatically created by Exchange Online and includes every mail-enabled object in the organization.
There are also the Address Book Policies, such as AL_AVA_DGs, which have a similar filter as the global address lists and are incorporated into the Global Address Lists:
AL_AVA_DGs | AVA All Users & Groups | ((((((RecipientType -eq 'UserMailbox') -or (RecipientType -eq 'MailUniversalDistributionGroup'))) -or (RecipientType -eq 'DynamicDistributionGroup'))) -and (CustomAttribute15 -eq 'AVA_ABP')) |
The CustomAttribute15 is an Exchange attribute that can be added onto AD/Azure accounts/Mailboxes. As an example, Tipton have TPT_ABP as their CustomAttribute15, GAL_TPT then picks this up and adds that mailbox to the GAL_TPT global address list.
Below is a collection of commands that can be used to edit existing ABPs, GALs, Rooms, Contact groups and create new ones.
Get-Mailbox -filter {windowsemailaddress -like '[email protected]'} | Set-Mailbox -CustomAttribute15 "TPT"
Get-DistributionGroup -filter {windowsemailaddress -like 'USER@DOMAIN'} | Set-DistributionGroup -CustomAttribute15 "SITECODE"
Get-DynamicDistributionGroup -filter {windowsemailaddress -like 'USER@DOMAIN'} | Set-DynamicDistributionGroup -CustomAttribute15 "SITECODE"
#Check if user has attribute
Get-Mailbox -identity USER |SELECT customattribute15
#Check if distribution group has attribute
Get-DistributionGroup -identity USER |SELECT customattribute15
#Check if dynamic distribution group has attribute
Get-DynamicDistributionGroup -identity USER |SELECT customattribute15
####AVA
$AVARL = 'AVA All Rooms'
$AVADGs = 'AVA All Users & Groups'
$AVACont = 'AVA All Contacts'
#Create address lists
#Create Users & DGs
New-AddressList -Name AL_AVA_DGs -displayname $AVADGs -RecipientFilter {((RecipientType -eq 'UserMailbox') -or (RecipientType -eq 'MailUniversalDistributionGroup') -or (RecipientType -eq 'DynamicDistributionGroup')) -and (CustomAttribute15 -eq 'AVA_ABP')}
#Create Contacts
New-AddressList -Name AL_AVA_Contacts -displayname $AVACont -RecipientFilter {(RecipientType -eq 'MailContact') -and (CustomAttribute15 -eq 'AVA_ABP')}
#Create Room lists (Even if room list empty for organisation)
New-AddressList -Name AL_AVA_Rooms -displayname $AVARL -RecipientFilter {(Alias -ne $null) -and (CustomAttribute15 -eq 'AVA_ABP') -and (RecipientDisplayType -eq 'ConferenceRoomMailbox') -or (RecipientDisplayType -eq 'SyncedConferenceRoomMailbox')}
####IPS
$IPSRL = 'IPS All Rooms'
$IPSDGs = 'IPS All Users & Groups'
$IPSCont = 'IPS All Contacts'
#Create address lists
#Create Users & DGs
New-AddressList -Name AL_IPS_DGs -DisplayName $IPSDGs -RecipientFilter {((RecipientType -eq 'UserMailbox') -or (RecipientType -eq 'MailUniversalDistributionGroup') -or (RecipientType -eq 'DynamicDistributionGroup')) -and (CustomAttribute15 -eq 'IPS_ABP')}
#Create Contacts
New-AddressList -Name AL_IPS_Contacts -DisplayName $IPSCont -RecipientFilter {(RecipientType -eq 'MailContact') -and (CustomAttribute15 -eq 'IPS_ABP')}
#Create Room lists (Even if room list empty for organisation)
New-AddressList -Name AL_IPS_Rooms -DisplayName $IPSRL -RecipientFilter {(Alias -ne $null) -and (CustomAttribute15 -eq 'IPS_ABP') -and (RecipientDisplayType -eq 'ConferenceRoomMailbox') -or (RecipientDisplayType -eq 'SyncedConferenceRoomMailbox')}
####AVA&IPS
$AVAABP = 'ABP_AVA&IPS'
$AVAGAL = 'GAL_AVA&IPS'
$AVAOAB = 'OAB_AVA&IPS'
$AVAABP = 'ABP_AVA&IPS'
#Create GALs
New-GlobalAddressList -Name $AVAGAL -RecipientFilter {(CustomAttribute15 -eq 'AVA_ABP') -or (CustomAttribute15 -eq 'Central_ABP') -or (CustomAttribute15 -eq 'IPS_ABP')}
#Create Room lists (Even if room list empty for organisation)
New-AddressList -Name AL_All_Rooms -displayname "All Rooms" -RecipientFilter {(Alias -ne $null) -and (RecipientDisplayType -eq 'ConferenceRoomMailbox') -or (RecipientDisplayType -eq 'SyncedConferenceRoomMailbox')}
#Create AVA & IPS OABs
New-OfflineAddressBook -Name $AVAOAB -AddressLists $AVAGAL
#Create AVA & IPS ADDRESS BOOK POLICY
New-AddressBookPolicy -Name $AVAABP -AddressLists $AVADGs,$AVACont -OfflineAddressBook "\$AVAOAB" -GlobalAddressList "\$AVAGal" -RoomList "\$AVARL"
#Assign ADDRESS BOOK POLICY
$AVA_IPS = Get-Mailbox -ResultSize unlimited -Filter ({CustomAttribute15 -eq 'AVA_ABP'} -or {CustomAttribute15 -eq 'IPS_ABP'}); $AVA_IPS | foreach {Set-Mailbox -Identity $_.Identity -AddressBookPolicy $AVAABP}
###TIPTON
$TPTABP = 'ABP_TPT'
$TPTGAL = 'GAL_TPT'
$TPTOAB = 'OAB_TPT'
$TPTRL = 'TPT All Rooms'
$TPTDGs = 'TPT All Users & Groups'
$TPTCont = 'TPT All Contacts'
$TPTABP = 'ABP_TPT'
#Create address lists
#Create Users & DGs
New-AddressList -Name AL_TPT_DGs -displayname $TPTDGs -RecipientFilter {((RecipientType -eq 'UserMailbox') -or (RecipientType -eq 'MailUniversalDistributionGroup') -or (RecipientType -eq 'DynamicDistributionGroup')) -and (CustomAttribute15 -eq 'TPT_ABP')}
#Create Contacts
New-AddressList -Name AL_TPT_Contacts -displayname $TPTCont -RecipientFilter {(RecipientType -eq 'MailContact') -and (CustomAttribute15 -eq 'TPT_ABP')}
#Create Room lists (Even if room list empty for organisation)
New-AddressList -Name AL_TPT_Rooms -displayname $TPTRL -RecipientFilter {(Alias -ne $null) -and (CustomAttribute15 -eq 'TPT_ABP') -and (RecipientDisplayType -eq 'ConferenceRoomMailbox') -or (RecipientDisplayType -eq 'SyncedConferenceRoomMailbox')}
#Create GALs
New-GlobalAddressList -Name $TPTGAL -RecipientFilter {(CustomAttribute15 -eq 'TPT_ABP') -or (CustomAttribute15 -eq 'Central_ABP')}
#Create OABs
New-OfflineAddressBook -Name $TPTOAB -AddressLists $TPTGAL
#Create ADDRESS BOOK POLICY
New-AddressBookPolicy -Name $TPTABP -AddressLists $TPTDGs,$TPTCont -OfflineAddressBook "\$TPTOAB" -GlobalAddressList "\$TPTGal" -RoomList "\$TPTRL"
#Assign ADDRESS BOOK POLICY
$TPT = Get-Mailbox -ResultSize unlimited -Filter {CustomAttribute15 -eq 'TPT_ABP'}; $TPT | foreach {Set-Mailbox -Identity $_.Identity -AddressBookPolicy $TPTABP}
###Central
$RSAABP = 'ABP_Central'
$RSAGAL = '\Default Global Address Book'
$RSAOAB = '\Default Offline Address Book'
$RSARL = '\All Rooms'
#Create ADDRESS BOOK POLICY
New-AddressBookPolicy -Name $RSAABP -AddressLists $TPTDGs,$TPTCont,$AVADGs,$AVACont -OfflineAddressBook $RSAOAB -GlobalAddressList $RSAGAL -RoomList $RSARL
#Assign ADDRESS BOOK POLICY
$RSA = Get-Mailbox -ResultSize unlimited -Filter {CustomAttribute15 -eq 'Central_ABP'}; $RSA | foreach {Set-Mailbox -Identity $_.Identity -AddressBookPolicy $RSAABP}
When setting up a new ABP, you need to reassign the attribute you are using as a recipient filter for the mailboxes to update their address list membership.
You can see mailbox address list membership with this command:
get-mailbox -identity [email protected] | select -ExpandProperty addresslistmembership
To reassign the attribute use these commands:
$emails = get-mailbox -resultsize unlimited -identity *@domain.co.uk | where {$_.customattribute15 -eq "Example_ABP"} | select name,windowsliveid,customattribute15
foreach($email in $emails.windowsliveid){set-mailbox -identity $email -CustomAttribute15 "Example_ABP"}