Home » Exchange Server » How to Export Mailboxes with Exchange Server 2010 SP1

How to Export Mailboxes with Exchange Server 2010 SP1

Exchange Server 2010 Service Pack 1 introduced a new method for exporting mailboxes called Mailbox Export Requests.  This new method replaces the previous Export-Mailbox command.

Before we look at how to create a new mailbox export request in Exchange 2010 SP1 there are a few things that you should understand.

Firstly, no accounts are granted the rights to export mailboxes by default.  You need to explicitly grant these rights, even to accounts that are organization administrators.

Secondly, the mailbox export request is processed by the Client Access server role.  Because multiple Client Access servers can exist in a site the request could be processed by any one of them.  To ensure that the path to the export PST file is valid for any Client Access server it has to be a UNC path to network share, not a local path.

Granting User Rights for Mailbox Exports in Exchange 2010 SP1

The first step is to grant the right to export mailboxes to an account in your organization.  In the Exchange Management Shell run the following command.

If you’re logged with that user already simply restart your Exchange Management Shell session to be granted access to the new cmdlets.

Creating a Network Share for Mailbox Exports in Exchange 2010 SP1

Next we need to create the network share that will be used as the file path for the exported PST files.  All that is required here is a network share that the Exchange Trusted Subsystem group has read/write permission to.

Exporting a Mailbox with an Exchange Server SP1 Mailbox Export Request

With everything configured properly we can now use New-MailboxExportRequest to start the mailbox export.  The only two required parameters for the command are the file path to the export PST file, and the name of the mailbox to export.

To view the status of the request use the Get-MailboxExportRequest cmdlet.

You can also see more detail about the mailbox export request with Get-MailboxExportRequest.

An easy way to see the progress of all mailbox export requests is to pipe Get-MailboxExportRequest into the Get-MailboxExportRequestStatistics cmdlet.

Exporting an Archive Mailbox with Exchange Server SP1 Mailbox Export Request

You can also export a user’s Personal Archive using mailbox export requests simply by adding the -IsArchive parameter to the command.

Completing the Mailbox Export Request

When a mailbox export request is completed it remains on the server until it is removed by an administrator using Remove-MailboxExportRequest.

To see all of the completed mailbox export requests run this command.

And to clear all completed mailbox export requests from Exchange run the following command.

Paul is a Microsoft MVP for Office Servers and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul is a co-author of Office 365 for IT Pros and several other books, and is also a Pluralsight author.
Category: Exchange Server

172 comments

  1. biba37 says:

    Hi,
    am getting this error while try MailboxExportRequest

    New-MailboxExportRequest –Mailbox “organizationuser” –Filepath “\CASHUB01PSTuser.pst”
    Couldn’t connect to the source mailbox.
    + CategoryInfo : NotSpecified: (0:Int32) [New-MailboxExportRequest], RemoteTransientException
    + FullyQualifiedErrorId : 49348511,Microsoft.Exchange.Management.RecipientTasks.NewMailboxExportRequest

    Share + User Rights are OK
    hostfile CASArray IP fake not working for me.

    Thank for help
    Biba

      • Mahesh Khanolkar says:

        Hi paul,

        am using below caoomd to export specific period data but no data has been import in pst.

        Please help.
        [PS] C:Windowssystem32>New-MailboxExportRequest -ContentFilter {(Received -lt ’09/30/2012′) -and (Received -gt ’09/19/2012′)} -Mailbox avendus.archival -Name 20sept -FilePath \ACPLMUM-HO-D020Archival20sept.pst

        Regards,
        Mahesh

    • Jason says:

      hi,
      had the same issue. The folder you are moving the PST too has to have been shared out to the user account who is doing the export and also advanced sharing permissions if applicable to everyone.

    • Ah. Okay in that case I don’t know for sure either way whether the import/export process works the same for a hosted mode install as it does for a normal install. But that might be the issue right there.

  2. Shawn Z says:

    1) Download “ExMerge” on to a Windows 2003 server with Exchange running on it.
    2) Copy “exchmem.dll” to the folder with the “ExMerge” contents.
    3) Give full perms to administrator or the user you logged in as to the server and mailboxes.
    a. In Exchange Manager, right click in server, properties and then security
    b. Uncheck inherit
    c. Add everyone, and give full control to everyone.
    d. Take ownership
    This ensures that you have the require “send as” and “receive as”, but the step here are very insecure. While this is insecure, it does effectively allow a mailbox backup or each user for a system that is about to be decommissioned.

  3. Chris Jershauge says:

    Hi Biba37

    I am running a Exchange as a Multi-Tenant installation, and I am using this command

    New-MailboxExportRequest –Mailbox “organizationuser” –Filepath \CASHUB01PSTuser.pst

    Please note that the path for the parameter FilePath is without ”
    I havent tryed it with the ” but without it works for me

  4. Jin says:

    Exchange server OS: windows 2008 R2
    Exchange 2010 SP1
    All domain controllers use Windows 2003 and did schema and prepare domains.

    I have
    main.com, aaa.main.com, bbb.main.com, ccc.main.com

    user name: aaatest

    I put aaatest in Organization Management & mailbox import export member.
    aaamain can do export pst file in aaa users.

    But i can not export bbb or ccc users.
    I get this error message
    _________________________________________________________________
    The operation couldn’t be performed because object ‘test1@bbb.main.com’ couldn’t be found on ‘domain.aaa.main.com’.
    + CategoryInfo : NotSpecified: (0:Int32) [New-MailboxExportRequest], ManagementObjectNotFoundException
    + FullyQualifiedErrorId : 978F19B3,Microsoft.Exchange.Management.RecipientTasks.NewMailboxExportRequest
    _______________________________________________________________

    What kind of permission i have to give aaatest user account to export in other domain ?
    I can create user in bbb or ccc domain names.

    Thanks.

  5. ChuckM says:

    FYI… Share permissions stopped the export for me with an “is denied”.

    For some reason, I had to add permissions on the folder for the user “SYSTEM” from the local machine (not the active directory).

  6. Pete Rosales says:

    Hello,

    I have several mailbox export requests where the mailbox was deleted before the request so now the failed request appears in RED when I do a get-mailboxmove statistics. How do I remove the RED move requests, not just the completed requests?

    Thanks!

  7. Kevin rose says:

    Thanks Paul for sharing this helpful step by step guide to export mailbox to PST. Both cmdlets are very useful for Exchange administrators. However, there are some limitations of these cmdlets as they do not work with damaged database. In order to use these cmdlets, The database file should be easily mounted in MS Exchange server.

    In case of corruption, only third party tools can help to convert edb to pst. file. Third party tools are designed with powerful technology to scan and repair the damaged database file. One such tool is given here: http://www.recover-computerdata.com/exchange-server-recovery.html

    This tool repairs the corrupt or damaged .edb file and export the mailboxes into separate .pst files which can be imported directly into MS Exchange Server or MS outlook.

  8. Anand_N says:

    Hi Paul, I signed up for your boot camp module 1 looked good video. quick question:
    Does outlook need to be installed on the exchange 2010 server for mailbox IMPORT and EXPORT cmdlets to work?

  9. santhosh sivaraman says:

    Hi Paul,

    I haven’t tried the Mailbox exporting yet.

    But I have a quick questoin. Does the New-MailboxExportRequest command will keep a copy of message inside mailbox or it is like cut & paste?

    Thanks,
    Santhosh

  10. Brent says:

    Tried running this today and I get the following error…
    The term ‘New-MailboxExportRequest’ is not recognized as the name of a cmdlet, function, script file, or operable program.

    We are running version 14.1 (build 218.15).

  11. Dotan says:

    Hi – Very cool. Can I use this cmdlet or a similar one to export mailboxes from an offline EDB? We take snapshots of our Exchange (VMware guest) and we can easily mount the drive and access the EDB file. If not directly from the EDB (like top $$$ recovery products), can we mount the EDB as another database in Exchange, without interfering with production operations?

    Thanks!

  12. Francisco says:

    For the following problem:
    Unable to open PST file ‘\Exch-Server1ImportsFile.pst’. Error details: Access to the path ‘\Exch-Server1ImportsFile.pst’ is denied.; Microsoft.Exchange.MailboxReplicationService.RemotePermanentException: Access to the path ‘\Exch-Server1ImportsFile.pst’ is denied.

    The solution is to add to the account ‘SYSTEM’ as a “Co-Owner” in the “Sharing Permissions” not only the Security Tab.

    Francisco

  13. Jason says:

    Is it ok to run the Exchange Management Shell on the same Exchange server that I am trying to run the export from? My Exchange server is 2010. Are there some versions that this doesn’t work on?

  14. Leo S says:

    Hi, I find the info very helpful, Just wonder if I can use this cmdlet to export the email items in one user’s mailbox into another mailbox (merging)? like:

    New-MailboxExportRequest -Mailbox jsmith | New-MailboximportRequest -Mailbox afuss

  15. Eddie says:

    This is great if you want to export a single mailbox. What about multiple mailboxes based on a domain, a security group membership or an OU? What about just exporting ALL Mailboxes?

  16. Hugh says:

    Thanks and greatly appreciated your time of creating this document.! It is very helpful and works great in my Exchange 2010 SP1 Update 4 environment.

  17. Arnel says:

    Hi Paul,

    Great Post! I think you could help us with our issue. Previously, we are able to issue a new mailbox export command without a problem but suddenly, for some reason one mailbox export process has failed (from viewing its status). Then after that, we are not able to issue the export command successfully anymore as we got this error.

    The server or share name specified in the path may be invalid, or the file could be locked
    + CategoryInfo : NotSpecified: (0:Int32) [New-MailboxExportRequest], RemotePermanentException
    + FullyQualifiedErrorId : 60FD650B, Microsoft.Exchange.Management.RecipientTasks.NewMailboxExportRequest

    Any help or idea, would much be appreciated. Thanks a lot.

    Arnel

  18. Arnel says:

    Hi Paul,

    Thank You. We figured out that the network share we are using has ran out of space thats why this is happening. For those who are having the same issue, it would be good to double check your network share if it still has plenty of space.

    Thanks Again!

    Arnel

  19. Joe says:

    Very well done tutorial. Saved me a lot of time. Now I can finally collapse my on premise Exchange in favour of Exchange Online.

  20. Ron Rossi says:

    Paul,

    1. Would this be a way to move a small number of mailboxes off an exchange 2010 server to migrate to an Exchange 2013 server prior to the availability of SP3?
    2. Is there a cmdlet for exporting the user’s contact list as well?
    3, How might one check to see these mailboxes and archives exported correctly before you remove the Exchange 2010 server so you might install Exchange 2013 on the domain?

    This is a terrific article.

    Ron

    • sreenivasa says:

      New-MailboxExportRequest -ContentFilter {(Participants -eq ‘SNorton@xyz.com’) -and (Received -gt ’03/03/2012′)} -Mailbox “cMERTZ” -FilePath \pitxxxpstsn.pst

      not working and Just Generating 256kb file. please help in running the correct command

  21. Carlos says:

    Hello Paul!. Amazing tutorial.

    I need some help please. When I run the command I get the following error:

    Could not connect to source Mailbox:
    + CategoryInfo : NotSpecified: (0:Int32) [New-MailboxExportRequest], RemotePermanentException
    + FullyQualifiedErrorId : A3C6C2EA,Microsoft.Exchange.Management.RecipientTasks.NewMailboxExportRequest

    servidor ‘/o=ENTERPRISE/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Configuration/cn=Servers/cn=mail.enterprise.com’ doesn’t exist.

    Do you know why am I receiving this error?

    Thank you very much!

  22. Amnon says:

    Unfortunately, I only have the disconnected mailbox, but the user account has already been deleted. You then get the error that the object couldn’t be foun on the DC… So no export to PST possible without the user account still available?
    Is an export still possible, having only the disconnected mailbox, without having to recreate a user account (SOx is in the way…)

  23. Lee Bergin says:

    Hi Paul

    I currently have 4 meeting room that we migrated from exchange 2003 to exchange 2010, they will only work if we have the direct booking registry key set in windows 7. Do you know if its possible to export the contents of the calendar and then delete the old room, recreate a new room of the same name and then import the calender and it keep the connections with appointments in end users calenders.

    I have checked all the settings against two new room that i setup and cannot find any differences.

    Thanks in advance for any advice or help you can offer

    Lee

    • I haven’t encountered that issue with migrated mailboxes before. You’ve checked that they are converted to Room mailboxes correctly and have the calendar configured correctly for autoaccept?

      I don’t think exporting/importing the calenders will keep the “connections” with other invitees but frankly I have no tested that myself.

  24. Jason Bedogne says:

    I have exported out 25+ mailboxes successfully, but I have two mailboxes that keep failing at 39 percent.

    Running Exchange Server 2010 with SP1.

    Any ideas?

  25. Dave Scott says:

    Why there isn’t an ExMerge equivalent for this version of Exchange is beyond me. All his crap for nothing. ExMerge was so reliable.

  26. Matt Vest says:

    This is a great post, but I wanted to add one small caveat that I have encountered, and am curious if this is true for everyone or a peculiarity with this particular Exchange server that I am running. When running this command, both the mailbox and filepath have to be in quotes for the command to run successfully. Is that a requirement, and if not, any idea why it is requiring me to put the command in that syntax?

  27. Joe T says:

    Hi Everyone, wondering if someone could help me intrepret a Mailbox Export Request that was documented in the Exchange Management Log (transaction below). Trying to figure out if “administrator” performed a copy of their own mailbox and saved it to Joe.pst file, or if the log shows that administrator accessed the Joe mailbox and made a copy to Joe/pst. Any help much appreciated.

    Information 12/31/12 01.01 MSExchange CmdletLogs 1 General Cmdlet suceeded. Cmdlet New-MailboxExportRequest, parameters {Mailbox=administrator, FilePath=\mailserverE$ExmergeJoe.pst}.

    • Jason Bedogne says:

      Not really an expert, but having exported out about 80 mailboxes now, it would appear that someone exported the Mailbox Administrator and saved it to a PST named Joe.

      The log that you left doesn’t show who did the exporting.

  28. Andrew says:

    You could write the last command like

    [PS] C:\>Get-MailboxExportRequest -Status “Completed” | Remove-MailboxExportRequest

  29. Shawn says:

    I beleive the cmdlets posted here “New-MailboxExportRequest” and “Get-MailboxRequest” apply to Exchange 2013 and not Exchange 2010. I have to run Export-Mailbox in Exchange to perform the steps being outlined here. Just a heads up.

      • This article opens with:

        “Exchange Server 2010 Service Pack 1 introduced a new method for exporting mailboxes called Mailbox Export Requests. This new method replaces the previous Export-Mailbox command.”

        To clarify, Export-Mailbox was in Exchange 2010 RTM. Exchange 2010 SP1 and above use the mailbox import/export request cmdlets instead.

        If you’re only able to use Export-Mailbox on your server that implies it is still the RTM version, which you should probably do something about as that version is no longer supported.

  30. Craig says:

    Paul, thank you for sharing your time as well as your vast knowledge and expertise with the IT community … really very helpful!

    I have an issue that I could use a little guidance on if you have the time; A few months back we setup a second forest and migrated some resources and companies from the parent forest to the new forest. We setup a separate Exchange 2010 organization … all is good (except for the obvious challenges and complexity). We were able to successfully use ADMT and Move requests etc to get our Exch 2007 mailboxes to 2010 then cross forest to the root domain containing Exch, then from there to another domain in the new forest. Changed the moved domains to InternalRelays and no problems.

    However, now I have a user who for whatever reason needs to xfer back to the parent (original) company in the old forest … and my Moverequests aren’t working. In fact I prepared the mailbox for move and just couldn’t get the remote (original) domain/forest to recognize the user’s mailbox guid. So I decided to just Export to PST and Import … but now it appears as though I might have messed things up with the Prep.

    When I follow your directions on the new forest’s Exch 2010 SP1 Server I am hit with the following error:
    ** actual user, server, and domain names have been substituted with canned text **

    The operation couldn’t be performed because object ‘username@domainB.dom’ couldn’t be found on ‘Exchange-Server’s-DC.domainA.dom’.
    + CategoryInfo : NotSpecified: (0:Int32) [New-MailboxExportRequest], ManagementObjectNotFoundException
    + FullyQualifiedErrorId : 6C8BC43A,Microsoft.Exchange.Management.RecipientTasks.NewMailboxExportRequest
    + PSComputerName : Exchange-Server.domainA.dom

    ** as for the substituted domain names:

    DomainA = domain in new forest where the new Exchange 2010 Org lives
    DomainB = domain in new forest where the new user lives … mailboxes are specified by UPN
    DomainC = (not listed above) domain in original forest where I was trying to move the mailbox and gave up.

    If you can offer any suggestions on how to un-Bork the “prepared” mailbox so that I can export it to PST, that would super awesome! Thanks a ton.

    • Craig says:

      As a follow up,

      I attempted to substitute the user’s mailbox name with the actual AD path as well (tried both UPN and Alias) with no luck:

      ** ran the following on the new forest’s Exchange 2010 SP1 server **

      New-MailboxExportRequest -Mailbox “cn=username,ou=usersOU,ou=childOU,ou=toplvlOU,dc=DomainB,dc=
      dom” -FilePath \Exchange-Server.domainA.domshare

      The requested search root ‘DomainB.dom/toplvlOU/childOU/usersOU’ is not within the scope of this operation. Cannot perform searches outside the scope ‘DomainA.dom’.
      + CategoryInfo : NotSpecified: (0:Int32) [New-MailboxExportRequest], ADOperationException
      + FullyQualifiedErrorId : 7E09615E,Microsoft.Exchange.Management.RecipientTasks.NewMailboxExportRequest
      + PSComputerName : Exchange-Server.domainA.dom

      Thanks again …

      • Craig says:

        I just connected to the user’s mailbox with an Outlook client after granting myself permissions to the mailbox and exported the contents to a PST.

        it’s crude, probably not the best way, but it gave me what I needed.

        I’m still interested in knowing if there is anything that I could have done to PST the mailbox via PowerShell … at this point, looking at the errors it appears to me that I have to first create a user in DomainA.dom, disconnect the mailbox from the user in DomainB.dom and associate it with the DomainA.dom user? If so then that’s “PureLameSauce” lol.

        Anyway, thanks.

  31. Russel says:

    Thank you for your time on this post and it works great, but I have a question and possible addition to this.

    I have about 450 users to Export to PST and was wondering if there is a way to use a wildcard in the command so I can Export all of the users in a particular DB. I have already moved all the users to DB and after I get all these users exported to PST and backed up I will be removing the DB. Doing it one at a time will take FOREVER.

    Thank you again for your time and help.

  32. Rob says:

    I had Exchange 2010 with SP1, but no other updates installed. The New-ExportMailboxRequest command was an unknown command. Added Update Rollup 8 and all was good.

    This export works fast – a great time-saver.

    Thanks for this.

  33. MarioTunes says:

    Hi Paul,

    Great Post!

    Do you know if it possible to migrate particular Exchange 2010 SP2 DB to the multiple PST files (each file named based on alias)?

    Thank you

    • MarioTunes says:

      Probably that should work

      Get-Mailbox -Database “Database1″ -ResultSize Unlimited | Export-Mailbox -PstFolderPath C:UserPST

      • MarioTunes says:

        Or the following script

        $mailboxes = get-mailbox -Database “Database1″ -ResultSize Unlimited

        foreach ($mailbox in $mailboxes) {

        new-mailboxexportrequest -mailbox $mailbox -FilePath \serverc$$mailbox.pst

        }

  34. Mark says:

    I exported a mailbox following this guide and afterwards found the mailbox was disconnected due a “soft delete”

    Is this expected behavior?

  35. Fabio says:

    Hello Paul,
    I executed following command:

    “New-MailboxExportRequest -Mailbox user-FilePath \localhostexportpstuser_mailbox.pst”

    The export worked fine.

    I deleted the pst created with the command and I ran “Get-MailboxExportRequest | remove-mailboxExportReques”. The command deleted all tasks and now I don’t have nothing in “Get-MailboxExportRequest”.

    If I try to export again the same mailbox the command does’t start the task and Get-MailboxExportRequest” is empty. If I try to export another maibox, all works fine.

    How I can export again the same mailbox?

    Thanks

  36. Michele says:

    Hi Paul,

    using New-MailboxExportRequest is it possible to export from a 50GB mailbox
    multiple .pst divided by MaxSize (Ex: MaxSize 1,2GB / Alias1.pst, Alias2.pst, etc..) ?

    thank you very much

  37. Kadir OZTURK says:

    hi, first between two dates determined by the archives of emails from pst how do you get as the second question is.. if I took out the emails from the edb file, how do I delete it ? can you help ? thanks

  38. Zacks says:

    HI Paul,
    I have executed the export command successfully, but if i check the status it stays on queued. Is the any way to force it to start?

  39. Tony E. says:

    I wanted to see if someone could clarify a question I have. When running the New-MailboxExportRequest does this only create a copy of the person’s mailbox or does this in fact move the items to the PST file. I did notice that the TechNet page mentions being able to run multiple instances on the same inbox so I believe it is the first (copy of mail.) Just don’t want to assume. “Assumptions the mother of all evil.

    Second questions how can I use this command to parse and only give me items larger than 34MB and not the whole mailbox. hope someone can help.

  40. Patrik J says:

    Hi Exchange pro 🙂
    Senario.
    We deleted mailbox. Created a new mailbox with same name. Now we need to export the deleted mailbox to a pst file.
    When I run New-MailboxExportRequest -Mailbox “USER” -FilePath \exch1ExchangeExportPSTUSER.pst Exchange export the new mailbox. How do I export the deleted mailbox? I can see the old mailbox when I run Get-MailboxDatabase | Get-MailboxStatistics | where {$_.DisconnectReason -ne $null} | ft displayname,database,disconnectreason

    /PJ

  41. Efrain says:

    Hi Paul!
    great article!
    I need to delete mails from the sent items on a specific mailbox on a date range. do you know of a way how?
    In Exchange 2007 there was an Export-Mailbox command and had the start date end date parameters but that doesn’t seem to work with 2010.

    Any pointers will be appreciated.

    Cheers!

  42. Harry says:

    Hi Paul, thanks for great. I tried to extract all mailboxes on particular DB to pst files. here is cmdlet I used and got following errors:

    [PS] C:Windowssystem32>foreach ($i in (Get-Mailbox -database TSXLABMBX1-DB1)) {New-MailboxExportRequest -Mailbox $i -C
    ontentFilter ((Received -lt “04/15/2014” -or (Sent -lt “04/15/2014”)) -FilePath “\tsxlabmbx-2pst$($i.Alias).pst” }
    You must provide a value expression on the right-hand side of the ‘-f’ operator.
    At line:1 char:169
    + foreach ($i in (Get-Mailbox -database TSXLABMBX1-DB1)) {New-MailboxExportRequest -Mailbox $i -ContentFilter ((Receive
    d -lt “04/15/2014” -or (Sent -lt “04/15/2014”)) -F <<<

    Did I miss any thing?

    note: if I removed -ContentFilter ((Received -lt “04/15/2014” -or (Sent -lt “04/15/2014”))

    it works fine. however, I do need end date but no start data

  43. Harry says:

    foreach ($i in (Get-Mailbox -database TSXLABMBX1-DB1)) {New-MailboxExportRequest -Mailbox $i -ContentFilter ((Received -lt “04/15/2014″ -or (Sent -lt “04/15/2014″)) -FilePath “\tsxlabmbx-2pst$($i.Alias).pst” }
    You must provide a value expression on the right-hand side of the ‘-f’ operator.
    At line:1 char:169
    + foreach ($i in (Get-Mailbox -database TSXLABMBX1-DB1)) {New-MailboxExportRequest -Mailbox $i -ContentFilter ((Receive
    d -lt “04/15/2014″ -or (Sent -lt “04/15/2014″)) -F <<<

    Did I miss any thing?

    note: if I removed -ContentFilter ((Received -lt “04/15/2014″ -or (Sent -lt “04/15/2014″))

    it works fine. however, I do need end date but no start data

  44. jon miller says:

    I have multiple databases and I want to export a mailbox for a single user in another database.
    by default new-mailboxexportrequest uses the main database (Mailbox Database 2098600682) , however there are 2 other databases (Mailbox DFMail & Mailbox Database FMail 2).
    All I want to do is export a mailbox from “Mailbox Database FMail 2”.

    How would I construct this? Using the parameter -database “Mailbox Database FMail 2” does not work.

    Thanks…

  45. Adriano Mendes says:

    Paul,

    Good morning! I Googled you page and I think you could help me a bit. I’m trying to create a batch file to:
    1-export the PST file from Exchange server
    2-return when the export is finished
    3-create a folder
    4-move the PST file to this folder

    So I created a batch file called EXP_PST.BAT. If I type inside powershell this command, it runs fine but it seems that I can’t run a .BAT inside Exchange Power Shell. How do I do that?

    This is the batch file:
    @echo off
    @echo Exporting user PST
    New-MailboxExportRequest -Mailbox %1% -FilePath \W2K8AMERMAIL1EXP_PST%1%.pst
    Get-MailboxExportRequest | Get-MailboxExportRequestStatistics
    pause
    @echo Creating user folder…
    md \csmrionetapp2datatiUser_Backup%1%
    @echo Moving PST file to folder…
    move \W2K8AMERMAIL1EXP_PST%1%.pst \csmrionetapp2datatiUser_Backup%1%%1%.pst
    @echo Exportation finished !

    I’m receiving some errors like:
    The term ‘exp_pst.bat’ 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:12
    + exp_pst.bat <<<<
    + CategoryInfo : ObjectNotFound: (exp_pst.bat:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

    • PowerShell scripts have a .ps1 extension, not .bat.

      You’ve jumbled in bat/cmd command and PowerShell commands there, that won’t work. If you want to run the whole thing as a PowerShell script you’ll just need to research the PowerShell commands to replace the bat/cmd commands there, eg md, pause, echo.

  46. John says:

    Paul – Quick question. If the PST are large like 10gb or more.. that is OK right? I am trying to answer the question if the PST’s are larger than 2Gb will they be 100% working PST files that you can open in outlook 2007 or newer versions of outlook. I see all kinds of articles saying you need 64 bit version of Outlook installed on a PC with power shell and only if exported from that machine are those PST’s good if larger then 2gb.

  47. Jorel says:

    I am able to execute the mailboxexportrequest and the status is “In Progress” until the pst file reaches around 2GB, it then stops and the status turns to “Failed”. I’d like to know if there’s a way I’d be able to see what may be causing the process to stop.

    here is the command that I am using and have worked for all the rest of my exports:

    New-MailboxExportRequest -Name “Jorel” -Mailbox JSV -FilePath “\servershare$Jorel_export.pst”

    Thank you,

  48. Jorel says:

    Paul,

    Thanks for your help! I found out that there were corrupt items within the mailbox and added the -BadItemLimit parameter to the syntax I was using.

    Really appreciate your time to read and reply.

    Have a great day!

  49. Adrian Farrugia says:

    Hi,

    Does this command backup the contacts and calender as well?
    New-MailboxExportRequest -Mailbox ‘xxxxx’ -FilePath ‘D:backupxxxx.pst’

    Thanks.

  50. Chris Bergman says:

    Hi Paul,

    Excellent article. This was very helpful with pulling mailboxes of terminated users for archive purposes.

  51. Christian Beauregard says:

    I Know this is an old post but seems like one thing was missing from this and it’s user permission.

    you cannot grant yourself the “Mailbox export import role” through powershell (did not work for me) but you can add it to your AD account + the share needs to have the Exchange trusted subsystem.

    Only then will this command works flawlessly

    • You can grant yourself the permissions, or if you don’t have high enough privileges in the Exchange org to do it then another admin who does can do it for you.

      The permissions on the file share is covered in the article already.

  52. Dariusvw says:

    Hi Paul

    I am looking for a way to move all the mail from user 1’s account to user 2’s account.
    User 1 has left the Organisation, but was part way through organizing a few events.

    We are using Exchange 2014 Version 14.02.0387.000
    Even if all you can do is point me in the right direction as to what the process/command is called.

    Thanks

  53. Stome007 says:

    Dear Pual,

    Suppose my old database mailbox (ex: Finance Database) got a big size. All user using MS Outlook download to their local computer already. My question is how to clean database mailbox or have another way to export only user in the old database then import to new database mailbox that we just create please?

    Regard,
    Stome007

      • Stome007 says:

        Dear Paul,

        Yes, we can move mailboxes to another database but it along with also attachment and mail data, so in this case our new database will remain a big size. My purpose is just want move only user information not data or attachment file in the user mailbox.

        Thanks

        • I think you’re misunderstanding the situation then. User information (attributes such as name, email address, etc) are stored in Active Directory.

          The Exchange database stores the mailbox items. There’s no moving of “user information” to another database.

  54. Gavin says:

    Hi Paul,

    Thanks for the great information. I have a particular request. I have a client that wants to archive email older than 2015. So, export to .PST and then remove the older emails from their current mailboxes in Exchange 2010. (SBS 2011). With 14 mailboxes, I could probably just go around each machine, but it would be nicer to use a powershell command to do this. What you have supplied and other information that I have would do the export nicely. The part that I have a question with is removing the older emails from the existing mailboxes. Any ideas?

  55. Gavin says:

    This doesn’t work if you are using any other regional date format than the US format. In other words, this information is only useful in the US. I have tested this. I have tried setting the computer region to US and it still doesn’t work. It is probably to do with the internally stored date format. It surprises me that Microsoft don’t use ISO date format for all data storage. I have found this before with T-SQL, so it doesn’t surprise me.

  56. Ali says:

    Hi,

    Thank you so much for the perfect and useful post,
    I’m trying to export part of the mailboxes based on the date, it finishes successfully but when i mount the PST file i figure out that many emails are missing specially when they are in folders.
    This is a script i use:

    New-MailboxExportRequest -ContentFilter {(Received -lt ’01/01/2014′) -and (Received -gt ’01/01/1900′)} -Mailbox “username” -Name usertopst -FilePath \xxxxxxxx

  57. Hans says:

    Hi Everyone

    I am trying to shrink a couple of really large exchange mailboxes using the New-MailboxExportRequest with a content filter and a date range. From what i understand this command only makes a copy of the mailbox items to a pst file. Is there a switch or something to specify that the mail should be moved and not copied or some totally different command to do this? i don’t want to use outlook archiving.

    thanks.

  58. Joseph says:

    Hello,
    I recently restored a server which hosted the AD and exchange… The exchange files were all on a separate drive (D). I backed up the D drive as is before doing the full restore of the system. On full restore, I have a server with exchange database that has mails dating up to the time I ran the backup. My question is, how can I read from the D drive backup which holds the latest emails instead of the recovered D drive that has old mails. I am using exch2010sp1. Thanks

Leave a Reply

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