Get-UnifiedGroup : The term ‘Get-UnifiedGroup’ is not recognized as the name of a cmdlet, function, script file, or operable program.

Reading Time: 2 minutes

Issue: When we try to access Office 365 group information i.e Get-UnifiedGroup it throws below error

PS C:\WINDOWS\system32> Get-UnifiedGroup

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:11
+ $Groups = Get-UnifiedGroup
+ ~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Get-UnifiedGroup:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

Solution:

Create a Session : PS C:\WINDOWS\system32> $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection

Import session missed while creating a session, so that we need to import the session

PS C:\WINDOWS\system32> Import-PSSession $Session
WARNING: The names of some imported commands from the module ‘tmp_o5s5o4kf.c4k’ include unapproved verbs that might
make them less discoverable. To find the commands with unapproved verbs, run the Import-Module command again with the
Verbose parameter. For a list of approved verbs, type Get-Verb.

ModuleType Version Name ExportedCommands
———- ——- —- —————-
Script 1.0 tmp_o5s5o4kf.c4k {Add-AvailabilityAddressSpace, Add-DistributionGroupMember…

After this, it is working fine.

PS C:\WINDOWS\system32> Get-UnifiedGroup

Name Alias ServerName AccessType
—- —– ———- ———-
Dev_b9be8cec-69bf-4a78… Dev sn6pr00mb0367 Private