The term ‘Search-Mailbox’ is not recognized as the name of a cmdlet

Problem:

When trying to use the Search-Mailbox commands to query Exchange Online (Office 365) you get the error: The term ‘Search-Mailbox’ is not recognized as the name of a cmdlet

Solution:

Proceed with the following steps:

Login to Office 365 and open the Exchange Online Admin Center.  Go to Permissions> Admin Roles> Discovery Management and add the user you are trying to run the command with as a member

The term 'Search-Mailbox' is not recognized as the name of a cmdlet

Connect to your organisation using PowerShell and run the two lines below:

New-RoleGroup "Mailbox Import-Export Management" -Roles "Mailbox Import Export"

Add-RoleGroupMember "Mailbox Import-Export Management" -Member robin.clarke@test.onmicrosoft.com 

 

You may also have to run this line if prompted:

Enable-OrganizationCustomization

 

Close and re-open your PowerShell session and the commands should now work.

One Reply to “The term ‘Search-Mailbox’ is not recognized as the name of a cmdlet”

  1. New-RoleGroup : The term ‘New-RoleGroup’ 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
    + New-RoleGroup
    + ~~~~~~~~~~~~~
    + CategoryInfo : ObjectNotFound: (New-RoleGroup:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Leave a Reply

Your email address will not be published. Required fields are marked *