2097 Posted September 7, 2023 Posted September 7, 2023 Just some guidance for people who are about to do some custom address lists , We were never originally with the kids on the email system . But we are now . Here is my ABP policy for staff. Btw our kids are also on a different domain name. New Global GAL New-GlobalAddressList -Name "GAL For Staff 2023" -RecipientFilter {((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'))) -and (WindowsEmailAddress -like "*@domain.com") )} All Pupils address List New-AddressList -Name "Emails For Pupils" -IncludedRecipients MailboxUsers -ConditionalCompany "School Pupils" All Staff Address List New-AddressList -Name "Emails For Staff" -IncludedRecipients MailboxUsers -ConditionalCompany "School Staff" OAB New-OfflineAddressBook -Name "StaffOAB" -AddressLists "\Emails For Staff", "\Emails For Pupils", "\All Staff Groups" New address list for groups only New-AddressList -Name "All Staff Groups" -RecipientFilter{(Alias -ne $null -and (ObjectClass -eq 'group'))} New room List New-AddressList -Name "All Rooms Staff" -RecipientFilter {(Company -eq "School Staff")-and (RecipientDisplayType -eq 'ConferenceRoomMailbox')} Create new policy New-AddressBookPolicy -Name "Staff & Pupils 070923" -AddressLists "\Emails For Staff", "\Emails For Pupils", "\All Staff Groups" -OfflineAddressBook "\StaffOAB" -GlobalAddressList "\GAL For Staff 2023" Set mailbox policy Set-Mailbox -Identity "SchoolUsername" -AddressBookPolicy "Staff & Pupils 060923" To Note : Once you set this on an account , you wont see any users ( or very few ) . This is because Exchange online needs a kick ! easiest way to do this is for every user change the extensionAttribute2 on their account with a random value (i.e. todays date ) this will then refresh everything once ADConnect runs an update . I used the following code Get-ADUser -Filter * -SearchBase "Path TO OU" -SearchScope 2 | Set-ADUser -Replace @{extensionAttribute2="070920232"} Note : Make sure ADconnect is setup to allow ExtensionAttribute2 to be copied over. You can test the filters above before you apply the ABP using Get-Recipient -RecipientPreviewFilter (Get-AddressList -Identity {Emails For Staff}).RecipientFilter You can set the ABP on all users using a script that connected to Exchange online and runs Get-Recipient -Filter '(Company -eq "School Staff") -and (recipienttypedetails -eq "usermailbox")' | Set-Mailbox -AddressBookPolicy "All Staff & Pupils"
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now