Skip to content

New-MailboxExportRequest is not recognized in Exchange Server

We need to export a mailbox to PST file. The problem is that we are getting an error after running the New-MailboxExportRequest cmdlet. The term ‘New-MailboxExportRequest’ 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. After the error, it did not export the mailbox to PST in Exchange Server. In this article, you will learn why this is happening and the solution to New-MailboxExportRequest is not recognized.

New-MailboxExportRequest is not recognized

Run Exchange Management Shell administrator. Run the New-MailboxExportRequest cmdlet, including -Mailbox and -Filepath parameters.

[PS] C:\>New-MailboxExportRequest -Mailbox amanda.morgan -FilePath "\\ex01-2016\pst\amanda.morgan.pst"
New-MailboxExportRequest : The term 'New-MailboxExportRequest' 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-MailboxExportRequest -Mailbox amanda.morgan -FilePath "\\ex01-201 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (New-MailboxExportRequest:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

After running the cmdlet, the output gives us the following error:

New-MailboxExportRequest : The term ‘New-MailboxExportRequest’ 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.

Why do we get this error, and what is the solution for new mailbox export request is not recognized?

Get role Mailbox Import Export

Let’s find out who is assigned to the role Mailbox Import Export. Make use of the Get-ManagementRoleAssignment cmdlet.

[PS] C:\>Get-ManagementRoleAssignment -role "Mailbox Import Export" -GetEffectiveUsers | ft -AutoSize

Name                                                     Role                  RoleAssigneeName        RoleAssigneeType AssignmentMethod EffectiveUserName
----                                                     ----                  ----------------        ---------------- ---------------- -----------------
Mailbox Import Export-Organization Management-Delegating Mailbox Import Export Organization Management RoleGroup        Direct           All Group Members
Mailbox Import Export-Organization Management-Delegating Mailbox Import Export Organization Management RoleGroup        RoleGroup        Administrator

What if you have a long list and you like to filter the result? Let’s search and filter on the account name.

[PS] C:\>Get-ManagementRoleAssignment -role "Mailbox Import Export" -GetEffectiveUsers | Where { $_.EffectiveUserName -like "Administrator" } | ft -AutoSize

Name                                                     Role                  RoleAssigneeName        RoleAssigneeType AssignmentMethod EffectiveUserName
----                                                     ----                  ----------------        ---------------- ---------------- -----------------
Mailbox Import Export-Organization Management-Delegating Mailbox Import Export Organization Management RoleGroup        RoleGroup        Administrator

If you inspect closely, you will find that the assignment grants Organization Management members like you only delegation rights. This allows you, as an organization administrator, to decide who can run Mailbox Import Export cmdlets.

Why are these roles not assigned to anyone by default?

When you assign the role “Mailbox Import Export”, it also grants full access rights to all mailboxes in its scope. Since this can be a security issue, it is not assigned to anyone by default.

Note: By default, nobody has access to import and export mailboxes in Exchange Server.

Solution for New-MailboxExportRequest is not recognized

In my example, the Administrator account is assigned to a Role Group called Organization Management. That group has access to the role Mailbox Import Export Delegating. We have to add the admin account to the role.

If the admin account is not added to the role, you are not able to run the cmdlet. This will not give you access to export mailboxes to PST.

We have two options:

  1. Add admin account directly to the role
  2. Create a new role group and add admin account to that group (recommended)

Important: After assigning the permissions, close Exchange Management Shell and rerun it for changes to take effect.

Option 1. Add admin account directly to the role

Run the following cmdlet to give the admin account access to the role.

[PS] C:\>New-ManagementRoleAssignment -Role "Mailbox Import Export" -User "Administrator" | ft -AutoSize

Name                                Role                  RoleAssigneeName RoleAssigneeType AssignmentMethod EffectiveUserName
----                                ----                  ---------------- ---------------- ---------------- -----------------
Mailbox Import Export-Administrator Mailbox Import Export Administrator    User             Direct

The account is successfully assigned to the Mailbox Import Export role.

Verify the permissions

You can double-check if you have access to the role with the first cmdlet in this article.

[PS] C:\>Get-ManagementRoleAssignment -role "Mailbox Import Export" -GetEffectiveUsers | ft -AutoSize

Name                                                     Role                  RoleAssigneeName        RoleAssigneeType AssignmentMethod EffectiveUserName
----                                                     ----                  ----------------        ---------------- ---------------- -----------------
Mailbox Import Export-Organization Management-Delegating Mailbox Import Export Organization Management RoleGroup        Direct           All Group Members
Mailbox Import Export-Organization Management-Delegating Mailbox Import Export Organization Management RoleGroup        RoleGroup        Administrator
Mailbox Import Export-Administrator                      Mailbox Import Export Administrator           User             Direct           Administrator

The admin account is Direct assigned to the role. Restart Exchange Management Shell and run the Mailbox Export cmdlet. The New-MailboxExportRequest is not recognized error is gone.

Option 2. Create a new Role Group and add admin account to that group

Run the following cmdlet to create a new role group and assign the admin account to that group.

[PS] C:\>New-RoleGroup -Name "Exchange Mailbox Import Export" -Roles "Mailbox Import Export" -Members "exoip\administrator" -DisplayName "Exchange Mailbox Import Export" -Description "This group will provide access to m
ailbox import and export cmdlets within entire Exchange Organization."

Name                           AssignedRoles           RoleAssignments                                        ManagedBy
----                           -------------           ---------------                                        ---------
Exchange Mailbox Import Export {Mailbox Import Export} {Mailbox Import Export-Exchange Mailbox Import Export} {exoip.local/Microsoft Exchange Security Groups/Organization Management, exoip.local/Users/Administrator}

The role group is successfully created, and the admin account is a member of the role group.

Verify the permissions

[PS] C:\>Get-ManagementRoleAssignment -role "Mailbox Import Export" -GetEffectiveUsers | ft -AutoSize

Name                                                     Role                  RoleAssigneeName               RoleAssigneeType AssignmentMethod EffectiveUserName
----                                                     ----                  ----------------               ---------------- ---------------- -----------------
Mailbox Import Export-Organization Management-Delegating Mailbox Import Export Organization Management        RoleGroup        Direct           All Group Members
Mailbox Import Export-Organization Management-Delegating Mailbox Import Export Organization Management        RoleGroup        RoleGroup        Administrator
Mailbox Import Export-Exchange Mailbox Import Export     Mailbox Import Export Exchange Mailbox Import Export RoleGroup        Direct           All Group Members
Mailbox Import Export-Exchange Mailbox Import Export     Mailbox Import Export Exchange Mailbox Import Export RoleGroup        RoleGroup        Administrator

Go to Active Directory and open the OU Microsoft Exchange Security Groups in the root domain of the forest. A new Universal Security Group is created with the name Exchange Mailbox Import Export.

New-MailboxExportRequest is not recognized in Exchange Server new Universal Security Group

You will also notice the admin account we specified has been added to Members.

New-MailboxExportRequest is not recognized in Exchange Server security group members admin

Now that you have the permissions, read the article Export Exchange mailbox to PST with PowerShell.

Remove permissions from the role

Security-wise, it’s good to remove the permissions after you’re done with the mailbox to PST export.

If you followed option 1, remove the admin account from the role.

[PS] C:\>Get-ManagementRoleAssignment -Role "Mailbox Import Export" | Where { $_.EffectiveUserName -like "Administrator" } | Remove-managementRoleAssignment

Confirm
Are you sure you want to perform this action?
Removing the "Mailbox Import Export-Administrator" management role assignment object. The following properties were configured: management role "Mailbox Import Export", role assignee "exoip.local/Users/Administrator",
delegation type "Regular", recipient write scope "Organization", and configure write scope "OrganizationConfig".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [?] Help (default is "Y"): Y

If you followed option 2, I recommend keeping the role group and only delete the admin account from it.

[PS] C:\>Remove-RoleGroupMember "Exchange Mailbox Import Export" -Member Administrator

Confirm
Are you sure you want to perform this action?
Removing the member "Administrator" from the role group "Exchange Mailbox Import Export".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [?] Help (default is "Y"): Y

If you need to export a PST in the future, you can always add the admin account to the group.

[PS] C:\>Add-RoleGroupMember "Exchange Mailbox Import Export" -Member Administrator

If you want to remove the created role group, run the following cmdlet.

[PS] C:\>Remove-RoleGroup "Exchange Mailbox Import Export"

Confirm
Are you sure you want to perform this action?
Removing the "Exchange Mailbox Import Export" role group object. The following properties were configured: management roles "Mailbox Import Export", managed by "Organization Management, Administrator". This operation
will also remove the following management role assignments: Mailbox Import Export-Exchange Mailbox Import Export
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [?] Help (default is "Y"): Y

Conclusion

You learned why New-MailboxExportRequest is not recognized in Exchange Server. Add the admin account directly to the Mailbox Import Export role. After assigning the permissions, restart Exchange Management Shell. Don’t forget to remove the assigned role permissions when the PST export is finished. The Microsoft Exchange team has written about this.

Did you enjoy this article? You may also like DFSRDIAG POLLAD is not recognized. Don’t forget to follow us and share this article.

ALI TAJRAN

ALI TAJRAN

ALI TAJRAN is a passionate IT Architect, IT Consultant, and Microsoft Certified Trainer. He started Information Technology at a very young age, and his goal is to teach and inspire others. Read more »

This Post Has 8 Comments

  1. Your posts are amazing. Thanks a lot for this. It worked perfect.

    For everyone that is reading; You really need to restart Exchange Management Shell for the changes to work (as shown in the post). I thought I mention it again just in case!

  2. As a heads up, because this is the #1 google return for this question and others might try it- these instructions do NOT work anymore. As of Date 10/2020. PSVersion=5.1.14393.3471 / azure AD module 2.0.2.4, even if you have the above rights, you still receive command not found.

Leave a Reply

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