Odpověď na: How to set up per database OAL and OAB in Exchange 2016

Úvodní stránka Fóra Microsoft Windows How to set up per database OAL and OAB in Exchange 2016 Odpověď na: How to set up per database OAL and OAB in Exchange 2016

#285878
patok
Správce

UPDATE:

I did some changes, because I’d forgot to involve „Public Folders“, and „Distribution Lists“. This time I use not only two, but three separated mail databases, bud grouping two of them together and one is completely separated:


New-AddressList -Name "All Rooms (DOM1+DOM2)" -RecipientFilter {(Alias -ne $null) -and ((Database -eq "CN=DOM1,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=example,DC=com") -or (Database -eq "CN=DOM2,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=example,DC=com")) -and (((RecipientDisplayType -eq 'ConferenceRoomMailbox') -or (RecipientDisplayType -eq 'SyncedConferenceRoomMailbox')))}
New-AddressList -Name "All Rooms (DOM3)" -RecipientFilter {(Alias -ne $null) -and (Database -eq "CN=DOM3,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=example,DC=com") -and (((RecipientDisplayType -eq 'ConferenceRoomMailbox') -or (RecipientDisplayType -eq 'SyncedConferenceRoomMailbox')))}

New-AddressList -Name "All Users (DOM1+DOM2)" -RecipientFilter {(Alias -ne $null) -and ((Database -eq "CN=DOM1,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=example,DC=com") -or (Database -eq "CN=DOM2,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=example,DC=com")) -and (((((((ObjectCategory -like 'person') -and (ObjectClass -eq 'user') -and (-not(Database -ne $null)) -and (-not(ServerLegacyDN -ne $null)))) -or (((ObjectCategory -like 'person') -and (ObjectClass -eq 'user') -and (((Database -ne $null) -or (ServerLegacyDN -ne $null))))))) -and (-not(RecipientTypeDetailsValue -eq 'GroupMailbox'))))}
New-AddressList -Name "All Users (DOM3)" -RecipientFilter {(Alias -ne $null) -and (Database -eq "CN=DOM3,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=example,DC=com") -and (((((((ObjectCategory -like 'person') -and (ObjectClass -eq 'user') -and (-not(Database -ne $null)) -and (-not(ServerLegacyDN -ne $null)))) -or (((ObjectCategory -like 'person') -and (ObjectClass -eq 'user') -and (((Database -ne $null) -or (ServerLegacyDN -ne $null))))))) -and (-not(RecipientTypeDetailsValue -eq 'GroupMailbox'))))}

New-AddressList -Name "Public Folders (DOM1+DOM2)" -RecipientFilter {(Alias -ne $null) -and ((Database -eq "CN=DOM1,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=example,DC=com") -or (Database -eq "CN=DOM2,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=example,DC=com")) -and (ObjectCategory -like 'publicFolder')}
New-AddressList -Name "Public Folders (DOM3)" -RecipientFilter {(Alias -ne $null) -and (Database -eq "CN=DOM3,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=example,DC=com") -and (ObjectCategory -like 'publicFolder')}

New-AddressList -Name "All Contacts (DOM1+DOM2)" -RecipientFilter {(Alias -ne $null) -and (RecipientContainer -eq "OU=DOM1\+DOM2,OU=Contacts,OU=COMPANY,DC=example,DC=com") -and (((ObjectCategory -like 'person') -and (ObjectClass -eq 'contact')))}
New-AddressList -Name "All Contacts (DOM3)" -RecipientFilter {(Alias -ne $null) -and (RecipientContainer -eq "OU=DOM3,OU=Contacts,OU=COMPANY,DC=example,DC=com") -and (((ObjectCategory -like 'person') -and (ObjectClass -eq 'contact')))}

# tried this for distribution lists, but to solve it as quick as possible I decided to create it in EMC; this doesn't work, but it can be useful for notion:
#New-AddressList -Name "All Distribution Lists (DOM1)" -RecipientFilter {(Alias -ne $null) -and (ObjectCategory -like 'group') -and (RecipientContainer -eq "OU=DOM1,OU=Groups,OU=COMPANY,DC=example,DC=com")}
#New-AddressList -Name "All Distribution Lists (DOM1)" -Container "example.com/COMPANY/Groups/DOM1" -RecipientFilter {(Alias -ne $null) -and (ObjectCategory -like 'group')}

New-GlobalAddressList -Name "Global Address List (DOM1+DOM2)" -RecipientFilter {(Alias -ne $null) -and ((Database -eq "CN=DOM1,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=example,DC=com") -or (Database -eq "CN=DOM2,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=example,DC=com")) -and (((ObjectClass -eq 'user') -or (ObjectClass -eq 'contact') -or (ObjectClass -eq 'msExchSystemMailbox') -or (ObjectClass -eq 'msExchDynamicDistributionList') -or (ObjectClass -eq 'group') -or (ObjectClass -eq 'publicFolder')))}
New-GlobalAddressList -Name "Global Address List (DOM3)" -RecipientFilter {(Alias -ne $null) -and (Database -eq "CN=DOM3,CN=Databases,CN=Exchange Administrative Group (FYDIBOHF23SPDLT),CN=Administrative Groups,CN=First Organization,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=example,DC=com") -and (((ObjectClass -eq 'user') -or (ObjectClass -eq 'contact') -or (ObjectClass -eq 'msExchSystemMailbox') -or (ObjectClass -eq 'msExchDynamicDistributionList') -or (ObjectClass -eq 'group') -or (ObjectClass -eq 'publicFolder')))}

New-OfflineAddressBook -Name "Offline Address Book (DOM1+DOM2)" -AddressLists "Global Address List (DOM1+DOM2)"
New-OfflineAddressBook -Name "Offline Address Book (DOM3)" -AddressLists "Global Address List (DOM3)"

New-AddressBookPolicy -Name "AddressBook Policy (DOM1+DOM2)" -AddressLists "\All Users (DOM1+DOM2)","\All Contacts (DOM1+DOM2)","\All Distribution Lists (DOM1+DOM2)","\Public Folders (DOM1+DOM2)" -OfflineAddressBook "\Offline Address Book (DOM1+DOM2)" -GlobalAddressList "\Global Address List (DOM1+DOM2)" -RoomList "\All Rooms (DOM1+DOM2)"
New-AddressBookPolicy -Name "AddressBook Policy (DOM3)" -AddressLists "\All Users (DOM3)","\All Contacts (DOM3)","\All Distribution Lists (DOM3)","\Public Folders (DOM3)" -OfflineAddressBook "\Offline Address Book (DOM3)" -GlobalAddressList "\Global Address List (DOM3)" -RoomList "\All Rooms (DOM3)"

Get-Mailbox -resultsize unlimited | where {$_.Database -eq "DOM1"} | Set-Mailbox -AddressBookPolicy "AddressBook Policy (DOM1+DOM2)"
Get-Mailbox -resultsize unlimited | where {$_.Database -eq "DOM2"} | Set-Mailbox -AddressBookPolicy "AddressBook Policy (DOM1+DOM2)"
Get-Mailbox -resultsize unlimited | where {$_.Database -eq "DOM3"} | Set-Mailbox -AddressBookPolicy "AddressBook Policy (DOM3)"