We have a exchange hybrid environment. (some users are in onpremises exchange and some users are office 365. )

When we want to export emails from onpremis we use , below command to export mail box and archive.

 New-MailboxExportRequest -Mailbox "user" -FilePath \\mysrv\l$\PST\Mailbox-user.pst; New-MailboxExportRequest -Mailbox "user" -IsArchive  -FilePath \\mysrv\l$\PST\Mailbox-user-archive.pst -confirm:$false

New-MailboxExportRequest works fine for onpremis users not for office 365. is there a way to export office 365 user mail box to pst using powershell ?

What i have tried so far:

I logged to office 365

$UserCredential = Get-Credential
Import-Module MSOnline

Connect-MsolService -Credential $UserCredential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication  Basic -AllowRedirection

Import-PSSession $Session

and tried New-MailboxExportRequest

But it generates an error. apparently office 365 dont know that command

PS C:\Users\pp> New-MailboxExportRequest
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
+ ~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (New-MailboxExportRequest:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Also Get-Command *Export* results are as follows

enter image description here

Tried googling, yet could not find a viable option. can some one guide me please ? What is the compatible command in office environment to do this ?

PS: I have tried https://www.codetwo.com/admins-blog/how-to-export-office-365-mailboxes-to-pst-using-ediscovery/ with E5 license and it works in the GUI perfectly. but my concern is even with e-discovery, and having license any possibility to do it with powershell ? i mean to script/automate via powershell ?

up vote 4 down vote accepted
+50

You can't export Exchange Online mailbox directly to PST via PowerShell with built-in tools. Required New-MailboxExportRequest doesn't exist Online (or is not exposed to us mortals).

You can:

  • eDiscovery, that seems to be GUI-only.
  • Offload/migrate mailbox to on-prem Exchange and run New-MailboxExportRequest on-prem (and migrate back to Exchange Online if needed)
  • Use various 3rd party tools, that perform export via EWS or MAPI
  • Script delegation full access, Outlook bind to delegated mailbox and export to PST. Technically very likely possible but I've never seen anyone do it. I haven't looked deeply into eDiscovery but I believe that's more-less how eDiscovery does export to PST (Old Exchanges also used to bind to Outlook for PST export). But without significant MAPI experience, Outlook COM model is quite complex to use (I've done some Outlook scripting but emulating PST export is challenging to say the least).

I'm as frustrated as you are. Exporting mailboxes for departing users for long-term storage is needlessly annoying. If we could just export to Azure Blob just as with import, it'd be a good start.

  • It seems Microsoft is so stingy to enable powershell method. – user879 May 15 at 18:27
  • veem office 365 backup seems promising, unlike ms ediscovery its pretty user friendly. veeam.com/backup-microsoft-office-365.html im trying a trial of it now.. anyway thanks for the answer! – user879 May 17 at 8:35

protected by Community Oct 9 at 8:24

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.