ASKER
$userOU = 'OU=Test,OU=Users,OU=DNB,DC=internal,DC=domain,DC=co,DC=uk'
$users = Get-ADUser -Filter * -SearchBase $userou -Properties SamAccountName
ForEach ($User in $Users) {
$SamAccountName = $User.SamAccountName
Set-ADUser -Identity "$SamAccountName" -Add @{
'proxyAddresses'="SMTP:$SamAccountName@domain.co.uk"
}
}
The proxy calculation logic uses the following sequence to calculate proxy addresses:
1. The default proxy address (SMTP, all capitals within proxyAddresses attribute) is checked first. If the domain is verified, the proxy address is synchronized and you will be provided with an MOERA based on your default proxy address alias. For example, if your default proxy address is joe@contoso.com, this proxy address will be synchronized and you will have an alternate email address of joe@contoso.onmicrosoft.com.
If your on-premises default proxy address domain is not verified, your SMTP address in Office 365 will use the MOERA based on the on-premises SMTP proxy address alias. For example, if your default proxy address is joe@contoso.com and contoso.com is not verified, your Office 365 default proxy address will be joe@contoso.onmicrosoft.com.
2. This step only applies if step 1 was not met and the user has a on-premises mail attribute:
o If the user does not have any on-premises proxy addresses and the email address domain within the mail attribute is verified, the user's Office 365 default email address will match the user's mail attribute.
o If the user does not have any on-premises proxy addresses and the email address domain within the mail attribute is not verified, the user's Office 365 default email address uses the alias portion of the users on-premises mail attribute and the MOERA domain. For example, if the users mail attribute is joe@contoso.com and the domain is not verified, your Office 365 default proxy address will be joe@contoso.onmicrosoft.com.
o If the user does have an on-premises proxy addresses, the user's Office 365 default email address uses the alias portion of the user's on-premises mail attribute and the MOERA domain. For example, if the user's mail attribute is joe@contoso.com and the domain is not verified, your Office 365 default proxy address will be joe@contoso.onmicrosoft.com even if the email domain of the mail attribute is verified.
3. This step only applies if logic step 1 and 2 are not met:
o Your Office 365 default proxy address will be based on your user principal name (UPN) alias and your MOERA domain even if the UPN domain is verified. For example, joe@contoso.onmicrosoft.com. .
Microsoft Office is an integrated suite of applications that includes Outlook, Word, Excel, Access, PowerPoint, Visio and InfoPath, along with a number of tools to assist in making the individual components work together. Coding within and between the projects is done in Visual Basic for Applications, known as VBA.
TRUSTED BY
Please refer the steps mentioned in the article "Add a domain to Office 365"
https://docs.microsoft.com/en-us/office365/admin/setup/add-domain?view=o365-worldwide