Skip to main content

You want to get the Offline Address Book with Exchange Online PowerShell. But, the following error appears: Get-OfflineAddressBook is not recognized as the name of a cmdlet. In this article, you will learn why this is happening and the solution to Get-OfflineAddressBook is not recognized.

Get-OfflineAddressBook is not recognized

After we Connect to Exchange Online PowerShell and run the Get-OfflineAddressBook cmdlet, the error appears:

Get-OfflineAddressBook : The term ‘Get-OfflineAddressBook’ 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.

PS C:\> Get-OfflineAddressBook
Get-OfflineAddressBook : The term 'Get-OfflineAddressBook' 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-OfflineAddressBook
+ ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Get-OfflineAddressBook:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Why is this happening and what is the solution?

Solution to Get-OfflineAddressBook is not recognized

The solution to this error is adding the Address Lists role to the Organization Management role group.

In Exchange Online, this Get-OfflineAddressBook cmdlet is available only in the Address Lists role, and by default, the role isn’t assigned to any role groups. To use this cmdlet, you need to add the Address Lists role to a role group (for example, to the Organization Management role group).

Assign Address Lists role in Microsoft 365 admin center

To add the Address Lists role to the Organization Management role group, follow these steps:

  1. Sign in to Microsoft 365 admin center
  2. Expand Roles and click on Role assignments
  3. Click on Exchange in the top bar
  4. Choose Organization Management from the list
Get-OfflineAddressBook is not recognized role assignments
  1. Click on Permissions
  2. Select the Address Lists role
  3. Click Save
Get-OfflineAddressBook is not recognized address lists

Assign Address Lists role with PowerShell

To assign the Address Lists role to the Organization Management role group with PowerShell, run the New-ManagementRoleAssignment cmdlet.

PS C:\> New-ManagementRoleAssignment -SecurityGroup "Organization Management" -Role "Address Lists"

Get the role assignments for the Organization Management role group.

PS C:\> (Get-RoleGroup "Organization Management").RoleAssignments | Sort-Object

The output needs to show the Address Lists-Organization Management role.

Verify Get-OfflineAddressBook works

Let’s verify that the Get-OfflineAddressBook cmdlet works.

Note: Wait an hour before you try and run the Get-OfflineAddressBook cmdlet. That’s because it takes time to propagate the changes on Microsoft’s cloud servers.

1. Run the Disconnect-ExchangeOnline cmdlet and close the PowerShell window.

PS C:\> Disconnect-ExchangeOnline

2. Start Windows PowerShell as administrator and Connect to Exchange Online PowerShell.

PS C:\> Connect-ExchangeOnline

3. Run the Get-OfflineAddressBook cmdlet.

PS C:\> Get-OfflineAddressBook

Name                         Versions   AddressLists                  
----                         --------   ------------                  
Default Offline Address Book {Version4} {\Offline Global Address List}

It’s a success!

Leave a Reply