Forum Discussion

Hasan Siddiqui's avatar
Hasan Siddiqui
Copper Contributor
Nov 30, 2017

Change O365 group email address using powershell

I am trying to change primarty SMTP of Office365 group but getting error:

 

We failed to update the unified group. Please try again later.
+ CategoryInfo : NotSpecified: (:) [Set-UnifiedGroup], TaskException
+ FullyQualifiedErrorId : [Server=CY4PR06MB3173,RequestId=3179c7a9-9182-449c-9bb1-d1a85e266ac1,TimeStamp=11/30/2017 1:22:37 AM] [FailureCategory=Cmdlet-TaskException] 64E
F00B1,Microsoft.Exchange.Management.RecipientTasks.SetUnifiedGroup
+ PSComputerName : ps.outlook.com

 

I am following steps mentioned in https://techcommunity.microsoft.com/t5/Office-365-Groups/Is-there-a-way-to-change-O365-group-email-address-using/td-p/49872 but no luck. Any help? 

 

The cmdlet i am running is :

Set-UnifiedGroup car@abc.onmicrosoft.com -EmailAddresses:@{add="car@domain.com"}

Set-UnifiedGroup car@abc.onmicrosoft.com -PrimarySmtpAddresses "car@domain.com"

 

 

  • Daniel Simpson's avatar
    Daniel Simpson
    Copper Contributor

    Using Set-Group seems to do the trick:

     

     Set-Group "GroupName" -WindowsEmailAddress "NewPrimaryEmail@domain.com"

    • Dan K.'s avatar
      Dan K.
      Copper Contributor

      I tested updating a group's primary domain with Set-Group and, while it did update the primary email in exchange, it still shows with the old domain in lists. Using Get-MsolGroup, I can see that not all of the properties were updated on the AzureAD side of things. I'm hoping they will fix the problem with set-unifiedgroup soon, as I have a bunch of groups that were supposed to be transition to a new domain on Monday!

      • Tim Crean's avatar
        Tim Crean
        Iron Contributor

        I am also trying to add an email address and then update the new email address to be primarysmtp on a number of old O365 groups.  I can add the new email address just fine, but get the "We failed to update the Unified Group" when I try to set the new address as PrimarySMTP.

         

        Also, not sure if related to this issue, but Set-UnifiedGroup does no appear to be accepting a value for the -HiddenFromExchangeClientsEnabled parameter.  If I try to set the parameter to $true, I get, "A positional parameter cannot be found that accepts argument 'True'."

        '

        From everything I have seen, I should be able to use that parameter so that certain groups will not appear/be discoverable in Outlook and Outlook on web clients.

    • Panagiotis Kagias's avatar
      Panagiotis Kagias
      Copper Contributor

      Using Set-Group seems to do the trick:

       

       Set-Group "GroupName" -WindowsEmailAddress "NewPrimaryEmail@domain.com"

       

       

      This one worked for me. Many thanks !

      • Dan K.'s avatar
        Dan K.
        Copper Contributor

        Just looking a little deeper, using Set-Group doesn't quite get it right when updating the primary SMTP domain. It seems to only update the exchange properties, and not AzureAD.

         

        After using Set-Group, I waited awhile to ensure time for any propagation, and then checked the group objects in both EOL and AAD. While Exchange properties looked good, the AAD properties looked as if nothing had changed.

         

        So, in the office admin portal list and get-msolgroup my test group is still showing the old domain, while the exchange properties and GAL correctly show the new domain. 

         

        Should we expect trouble down the road with a discrepancy like this?

  • This first example will add the alias as secondary, not primary. You only need the second one, although the parameter name should be -PrimarySmtpAddress, not -PrimarySmtpAddresses. In any case, this looks like a temporary glitch, so try rerunning the cmdlet.

    • Hasan Siddiqui's avatar
      Hasan Siddiqui
      Copper Contributor

      Hi Vasil, 

      That was just typo for primarysmtp. I am still getting this error and i am getting this error since long. Can't change primary smtp. 

      • VasilMichev's avatar
        VasilMichev
        MVP

        You can always open a support case and have it properly investigated.

  • J.C. Bartle's avatar
    J.C. Bartle
    Copper Contributor

    Hello,

     

    We ran into this as well and did open a Premier Support request with Microsoft. The answer we received was that the PrimarySmtpAddress attribute can only be updated by an account with the Global Administrator role. More restrictive roles such as User Management Administrator or Exchange Administrator are not sufficient. We did verify that our folks with the Global Admin role can indeed successfully run the commands which fail for other individuals.

     

    So the solution - for now, anyway - is to have someone in the Global Admin role update the primary SMTP address when needed.

  • Hi Hasan

     

    As Vasil mentions, if all you're looking to do is to add a new email address as the primary SMTP address of the group, then you can achieve it by just using the -PrimarySmtpAddress option in Set-UnifiedGroup cmdlet.

  • MOONSO KO's avatar
    MOONSO KO
    Copper Contributor

    Even though I logged in as a global administrator, I received the same error. It has been working fine but suddenly it didn't work.

     

    # Info

    • Date: 2018-06-01 to 2018-06-02
    • Command: Set-UnifiedGroup -Identity "old@mydomain.com" -PrimarySmtpAddress "new@mydomain.com"
    • Error Message:
      We failed to update the unified group. Please try again later.+ CategoryInfo : NotSpecified: (:) [Set-UnifiedGroup], TaskException+ FullyQualifiedErrorId : [Server=HK0PR03MB3522,RequestId=66c8baa3-35be-40d9-8661-5db74747fa11,TimeStamp=6/2/2018 5:17:01 AM] [FailureCategory=Cmdlet-TaskException] 67671B94,Microsoft.Exchange.Management.RecipientTasks.SetUnifiedGroup+ PSComputerName : outlook.office365.com
    • Version (16.0.0.0)
      - Name: Microsoft.Exchange.Management.ExoPowershellModule

     

    # My Test

    • Period: 2018-06-01 to 2018-06-02
    • Console: PowerShell ISE, Visual Studio Code - PowerShell Integrated Console
    • Tested with two users
      • A global administrator
      • My account : changed my account role to a global administrator

     

    • Mohammad Sarosh's avatar
      Mohammad Sarosh
      Icon for Microsoft rankMicrosoft

      Hi MOONSO KO

      We are currently experiencing a temporary outage in this service. The cmdlet should be working again soon.

      • Jim Duncan's avatar
        Jim Duncan
        Iron Contributor

        Mohammad Sarosh wrote:

        Hi MOONSO KO

        We are currently experiencing a temporary outage in this service. The cmdlet should be working again soon.


        Can you provide a bit more information about when the cmdlet should be working? We REALLY need to change the email address of one of our Office 365 Groups, as soon as possible.

         

        Is this outage something that will show in Service Health in the O365 Admin Center?

         

        Thanks,

        Jim

    • Jason Paul Viola's avatar
      Jason Paul Viola
      Copper Contributor
      Hi MOONSO KO,

      You can try the following cmdlet to update the primary SMTP address of the O365 group.

      Set-UnifiedGroup -Identity old@mydomain.com -EmailAddress @{remove=”SMTP:old@mydomain.com”;add=”SMTP:new@mydomain.com”,”smtp:old@mydomain.com”}

      This should update the primary SMTP address to the new@mydomain.com and set the old@mydomain.com to a secondary SMTP address.
      • Rob Hardman's avatar
        Rob Hardman
        Iron Contributor

        Hi Jason,

         

        I'm in the same position as Moonso Ko. In my case, attempting your workaround did alter the email addresses, but not the primary SMTP address for the group, and returned the error;

         

        There is no primary SMTP address.
        + CategoryInfo : NotSpecified: (XXXXXXXX:ADObjectId) [Set-UnifiedGroup], DataValidationExcept
        ion
        + FullyQualifiedErrorId : [Server=XXXXXX,RequestId=e54f49cd-6dd5-4309-9c96-a415efc1ced5,TimeStamp=6/5/2018
        8:17:00 PM] [FailureCategory=Cmdlet-DataValidationException] 4FC61324,Microsoft.Exchange.Management.RecipientTasks
        .SetUnifiedGroup
        + PSComputerName : outlook.office365.com

         

        HTH,

         

        Rob

    • Deleted's avatar
      Deleted

      I know that this issue says it was resolved last month but when I have been trying to update a primary SMTP this way this week I am still receiving the We failed to update the unified group:

       

      We failed to update the unified group. Please try again later.
      + CategoryInfo : NotSpecified: (:) [Set-UnifiedGroup], TaskException
      + FullyQualifiedErrorId : [Server=BN6PR1101MB2274,RequestId=135505a2-5022-4866-aecd-acbb2a1636ba,TimeStamp=7/11/2018 4:18:45 PM] [FailureCategory=Cmdlet-TaskException] 9FB8B110,Microsoft.Exchange.Management.RecipientTasks.SetUnifiedGroup
      + PSComputerName : outlook.office365.com

      • Mohammad Sarosh's avatar
        Mohammad Sarosh
        Icon for Microsoft rankMicrosoft

        Hi Bradley

        We aren't seeing this issue anymore. Can you contact support to get this resolved?

Resources