Last active
June 28, 2017 15:42
-
-
Save sob/f121445435ad2ef9a8efd0cae57d55e0 to your computer and use it in GitHub Desktop.
Remove vanity domain from O365
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
Get-MsolUser | ForEach-Object { $upn = $_.UserPrincipalName.Split("@")[0] + "@holytrinityschools.onmicrosoft.com"; Set-MsolUserPrincipalName -ObjectId $_.ObjectId -NewUserPrincipalName ($upn) } |
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
Get-DistributionGroup | ForEach-Object { $email = $_.PrimarySmtpAddress.split("@")[0] + "@holytrinityschools.onmicrosoft.com"; Set-DistributionGroup $_.identity -EmailAddresses $email } |
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
Get-UnifiedGroup | ForEach-Object { $email = $_.PrimarySmtpAddress.split("@")[0] + "@holytrinityschools.onmicrosoft.com"; Set-UnifiedGroup $_.identity -EmailAddresses $email } |
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
Get-User | Where-Object { $_.RecipientType -eq "MailUser"} | Remove-MailUser |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment