Forum Discussion

Eduardo_Ricardez's avatar
Eduardo_Ricardez
Copper Contributor
Aug 08, 2023

Command New-DistributionGroup doesn't work

Hi Guys,   I am really new with Powershell, so I apologise, if I can't be very clear with the description of my problem. My Company uses Microsoft 365 and I wanted to use Powershell  and the comma...
  • LainRobertson's avatar
    LainRobertson
    Aug 08, 2023

    Eduardo_Ricardez 

     

    Hi, Eduardo.

     

    That's what I was expecting to hear.

     

    The commandlet definitely exists, however, when you run Connect-ExchangeOnline, only the commandlets you have access to are loaded.

     

    If you don't see a particular command, it means the account you have logged in with during Connect-ExchangeOnline does not have enough access to see and use that commandlet.

     

    Using the following article's guidance, we can see which roles give access to New-DistributionGroup:

     

     

    (Get-ManagementRole -Cmdlet New-DistributionGroup).Name |
        ForEach-Object {
            Get-ManagementRoleAssignment -Role $_ -Delegating:$false | Format-Table -AutoSize Role, RoleAssigneeType, RoleAssigneeName;
        }

     

    Output:

     

    So, we can see from this that the account you logged in with using Connect-ExchangeOnline needs to be a member of either:

     

    • Organization Management
    • Recipient Management

     

    The one thing that is for certain is that if you're not seeing the command, your account does not have the necessary rights to do so. It's not a problem with the commandlet not existing.

     

    Cheers,

    Lain

Resources