Problem: Getting “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.” error in PowerShell!
Root Cause and Solution:
You must connect to Exchange Online, Before using the Get-UnifiedGroup or Set-UnifiedGroup cmdlet that interacts with Microsoft 365 groups.
Solution 1: Install the Exchange Online PowerShell Module!
The Get-UnifiedGroup cmdlet is part of the Exchange Management module, and it may not be installed in your system! So, to resolve the problem, You have to install the Exchange Online Module for PowerShell and connect to Exchange Online first.
#Install Exchange Online Management Shell
Install-Module -Name ExchangeOnlineManagement
#Connect to Exchange Online
Solution 2: Create and Import a PSSession
Without the Exchange Online Management Module, You can connect to Exchange Online using PSSession. However, the PSSession method will be deprecated soon.
$Credential = Get-Credential
#Create the session
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ `
-Credential $Credential -Authentication Basic -AllowRedirection
#Import the session
Import-PSSession $Session -DisableNameChecking
#Get all Office 365 Group
A similar solution applies to “set-unifiedgroup is not a recognized cmdlet” error as well.