Microsoft 365 features that help users manage their subscriptions, account settings, and billing information.
Hello IT Tech [Mo],
If you are using Exchange Hybrid environment, and user mailboxes are moved from Exchange on-prem to Online, based on my knowledge, it is suggested to use EMS to change user SMTP address:
Set-RemoteMailbox –Identity <user identity> -EmailAddress SMTP*:<Primary Email Address>* ,<Alias Email Address 1>,<Alias Email Address 2>
If you want to edit AD object properties in AD local via PowerShell script, you may need to change user EmailAddress and Proxy addresses properties :
As far as I know, Get-ADUser command can filter user based on Active Directory path
$path = "OU=TestOU,DC=contoso,DC=com"
$users = Get-ADUser -SearchBase $path –Filter *
And then update user addresses via Set-ADUser.
Besides, since above commands for editing AD object properties may not satisfy your business needs, and we have limited capabilities regarding strictly coding PowerShell script, you are suggested to contact scripting forum to seek expert assistance: https://social.technet.microsoft.com/forums/en-us/home?category=scripting&filter=alltypes&sort=lastpostdesc
Best Regards,
Anna