π§ AddAlias.ps1 Setup Guide
π― What This Script Does
This script finds all users in a specified OU and gives them a new email alias. This new alias (e.g., user@authn.domain.com) can be used to sign in to their main account (user@domain.com).
π οΈ Step 1: Prepare Your Environment
Create an Organizational Unit (OU) in Active Directory.
Move all users who need aliases into this OU.
Example OU:
OU=AuthN_Users,DC=domain,DC=com
βοΈ Step 2: Customize the Script
Right-click the
AddAlias.ps1file and choose Edit (or open with Notepad/VS Code).Update Line 1:
Change the OU path to match your environment.
# Replace this:
$Users = Get-ADUser -Filter * -SearchBase "OU=TestUsers,DC=domain,DC=com"# With your OU path (Example):
$Users = Get-ADUser -Filter * -SearchBase "OU=AuthN Users,DC=contoso,DC=com"
Update Line 4:
Change the alias domain to match yours.
# Replace this:
"smtp:$($user.samaccountname)@new.domain.com"# With your alias domain (Example):
"smtp:$($user.samaccountname)@authn.domain.com"
Save the file.
