Skip to content

Instantly share code, notes, and snippets.

@mardahl
Created August 29, 2018 19:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mardahl/9154427d07f680cb8d427093f20a90f1 to your computer and use it in GitHub Desktop.
Save mardahl/9154427d07f680cb8d427093f20a90f1 to your computer and use it in GitHub Desktop.
#Simple script to change all Unified Groups (Office 365 Groups) Primaty SMTP email address to a new domain.
#It's recomended to have a diferent email domain for Office 365 Groups, so they dont conflict with regular user and system mailboxes.
$groups = get-unifiedgroup | select-object name,alias
Foreach ($group in $groups) {
Set-UnifiedGroup –Identity "$($group.name)" –PrimarySmtpAddress "$($group.alias)@groups.contoso.com"
}
@mardahl
Copy link
Author

mardahl commented Aug 29, 2018

One that I use often during hybrid migrations to Office 365, so leaving it here for others to use :)

@mardahl
Copy link
Author

mardahl commented Sep 2, 2018

In order to set a default email policy for Office 365 group creation, the following command can be used:

New-EmailAddressPolicy -Name Groups -IncludeUnifiedGroupRecipients -EnabledEmailAddressTemplates "SMTP:@groups.contoso.com" -Priority 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment