at the moment I run a daily task which runs some basic powershell scripts to filter users by an attribute and apply a different ABP.
For example
get-user -resultsize "unlimited" -Filter {(stateorprovince -eq "STANDARD") -and (city -ne "provisioned")} | %{Set-Mailbox $_.DistinguishedName -AddressBookPolicy "STANDARD_ABP" -WarningAction "silentlycontinue"}get-user -resultsize "unlimited" -Filter {(Customattribute1 -eq "DOMAIN1") -and (city -ne "provisioned")} | %{Set-Mailbox $_.DistinguishedName -AddressBookPolicy "DOMAIN1_ABP" -WarningAction "silentlycontinue"}
get-user -resultsize "unlimited" -Filter {(Customattribute1 -eq "DOMAIN2") -and (city -ne "provisioned")} | %{Set-Mailbox $_.DistinguishedName -AddressBookPolicy "DOMAIN2_ABP" -WarningAction "silentlycontinue"}
this works fine, but I'm about to introduce 200+ domains, which would mean adding a repeated script for every single domain, most will want an individual ABP...although some are happy to Share the Standard ABP.
Can this script be done in a better way? maybe calling a CSV and using some sort of function?