Last active
October 25, 2021 07:00
-
-
Save Apoc70/39a22f4e3c25ead001938e5b0f8ee2d7 to your computer and use it in GitHub Desktop.
Update UPN suffix for all users in preparation Azure AD Connect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Update the User Principal Name for all User Objects | |
$CustomDomain = "mcsmemail.de" | |
# Add custom domain as suffix first | |
Get-ADForest | Set-ADForest -UPNSuffixes @{add=$CustomDomain} | |
# Update all user objects | |
Get-ADUser -Filter * -Properties SamAccountName | ForEach-Object { Set-ADUser $_ -UserPrincipalName ($_.SamAccountName + "@$($CustomDomain)" )} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment