Created
October 28, 2022 10:27
-
-
Save Fantasillion/c4f4225bdea8c0fe7d00d675e5bfe35c to your computer and use it in GitHub Desktop.
Replace Primary Mail Address on Group
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
#Instructions for both O365 Groups and Distribution Lists | |
#For O365 Groups: | |
#1.a Find specific group name. Replace put group name here with the name of the group. | |
Get-UnifiedGroup -Identity "put group name here" | Select Name,@{Name="NameLength";Expression={$_.name.length}}, EmailAddresses, Alias, ServerName, AccessType | |
#1.b List all groups with names. | |
Get-UnifiedGroup | Select Name,@{Name="NameLength";Expression={$_.name.length}}, EmailAddresses, Alias, ServerName, AccessType | |
#2. Add mail address. Replace put group name here with the name of the group. Replace putmail address here with the new mail address. | |
Set-UnifiedGroup -Identity "put group name here" -EmailAddresses: @{Add ="put mail address here"} | |
#3. Replace primary address. Replace put group name here with the name of the group. Replace putmail address here with the new mail address. | |
Set-UnifiedGroup -Identity "put group name here" -PrimarySmtpAddress "put mail address here" | |
#For Distribution Groups: | |
#Same but Get-DistributionGroup and Set-DistributionGroup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment