Friday, 13 July 2018

The term 'Get-UnifiedGroup' is not recognized as the name of a cmdlet

When you run the powershell cmdlet Get-UnifiedGroup you might have received the following error.
Get-UnifiedGroup : The term 'Get-UnifiedGroup' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ Get-UnifiedGroup
+ CategoryInfo          : ObjectNotFound: (Get-UnifiedGroup:String) [],CommandNotFoundException+ FullyQualifiedErrorId : CommandNotFoundException
The command Get-UnifiedGroup belongs to Exchange Online powershell module and you can use this cmdlet to view Office 365 groups in your cloud-based organization.

Solution 1:

Before running this cmdlet, first you have to Exchange Online module by running following commands:
$o365Cred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri -Credential $o365Cred -Authentication Basic -AllowRedirection
Import-PSSession $Session

Solution 2:

You might have received the same error even after loaded the Exchange Online module. In this case, the error might occurs due to the user account that you used to connect Exchange Online may not have required permissions to run this cmdlet.

To run this cmdlet, the user account needs the permissions Mail Recipients (RoleType: MailRecipients) and View-Only Recipients (RoleType: ViewOnlyRecipients).

If you have global admin account (or other high privileged account), then you can find the permissions required to run Get-UnifiedGroup cmdlet by running following command.
PS C:\> Get-ManagementRole -Cmdlet "Get-UnifiedGroup"

Name                 RoleType
----                 --------
Mail Recipients      MailRecipients
View-Only Recipients ViewOnlyRecipients

Add user into required role group:

To grant the required permissions, you need to add the user into a role group which contains "Mail Recipients" or "View-Only Recipients", such as Organization Management / Recipient Management group, etc.

Run the following powershell command to add the user into the role group "Organization Management":
Add-RoleGroupMember "Organization Management" -Member ""
You can also add the required role through Exchange Admin center:
  • Go to Office 365 Admin center.
  • In the left navigation, expand Admin centers, and then select Exchange.
  • In the Exchange Administration Center (EAC), navigate to Permissions > Admin Roles.
  • Select the group "Organization Management" and then click on Edit icon.
  • In the Members section, click on Add (+) button.
  • Select the required users, click on Add, and then click on OK.
  • Click on Save to save the changes to the role group.


No comments:

Post a Comment