Assume that you run the New-MailboxRestoreRequest and New-MailboxExportRequest cmdlets in Microsoft Exchange Server 2016 PowerShell. When the TargetMailbox parameter includes a white-space, you may receive a "NullReferenceException" error message. For example:

[PS] C:\Windows\system32>New-MailboxRestoreRequest -SourceDatabase " <DatabaseIdParameter>" -SourceStoreMailbox " <StoreMailboxIdParameter> " -TargetMailbox "MS Test" -AllowLegacyDNMismatch
WARNING: An unexpected error has occurred and a Watson dump is being generated: Object reference not set to an instance of an object.
WARNING: Task module "LoggingModule.OnIterateCompleted" fails with exception "Object reference not set to an instance of an object.".
This module is skipped. Task execution result should not be affected.
Object reference not set to an instance of an object.
   + CategoryInfo          : NotSpecified: (:) [New-MailboxRestoreRequest], NullReferenceException
   + FullyQualifiedErrorId : System.NullReferenceException,Microsoft.Exchange.Management.Migration.MailboxReplication
   + PSComputerName        : <ComputerName>

In addition, an Event ID 4999 with a "NullReferenceException" error will be logged in the Event Viewer. It's expected that the cmdlets can run successfully regardless of the white-space included in the TargetMailbox parameter.


This issue occurs because one parameter is returning a wrong value when the TargetMailbox parameter has a white-space in it.


To resolve this issue, install Cumulative Update 11 for Exchange Server 2016 or a later cumulative update for Exchange Server 2016.


Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.


Learn about the terminology that Microsoft uses to describe software updates.

Need more help?

Expand your skills
Explore Training
Get new features first
Join Microsoft Insiders

Was this information helpful?

What affected your experience?

Thank you for your feedback!