Our company is moving from legacy addresses formatted as the first initial plus surname, such as [email protected], to a newer format using [email protected]. I need to add the new-format address as an alias for several hundred existing users while retaining their current addresses. What would be a safe PowerShell approach for identifying the right users, generating the new aliases, applying them, and validating the results?
4 Answers
Break the job into smaller steps: retrieve the users, filter out anyone who already has the expected address, generate the address from the user properties, update one test account, and then validate it before processing everyone. Once the single-user command works, wrap it in a foreach loop and run it in small batches. Also include logging so you can review what changed and which accounts failed.
Start by selecting users whose current addresses do not match the new naming convention, using a regex or explicit checks. Build each proposed address from the user's first and last name, but account for duplicates, spaces, apostrophes, hyphens, preferred names, and users who already have an alias. Export a preview first, check for collisions, and only then apply the changes. Test outside production and process a small batch at a time.
Before writing the bulk script, make sure you know whether the environment is on-premises Active Directory, Exchange Online, or a hybrid setup, because the appropriate cmdlets and source-of-authority differ. A script generated by an AI tool can be a starting point, but it still needs review, a dry-run mode, backups or an export of the original values, and verification after each batch.
If these are Exchange or Exchange Online recipients, the alias normally belongs in the proxy address collection rather than being treated as a regular directory email field. Add the new address there, and use the uppercase SMTP: prefix only if you intend to make it the primary address; lowercase smtp: adds a secondary alias. In a synchronized environment, the directory synchronization process may update the cloud-side mail attributes afterward.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures