Using the Exchange 2010 Mailbox Export features for Mass Exports to PST files

In Exchange 2007 SP1 thru to Exchange 2010 RTM, the Export-Mailbox command was the replacement for the once-familiar ExMerge utility when it came to exporting mailboxes to PST files.

The main problem with Export-Mailbox for most Exchange administrators is the requirement for Outlook – either on a 32-bit machine with Management Tools for Exchange 2007, or on a 64-bit machine for Exchange 2010. All in all, it wasn’t ideal and certainly didn’t facilitate scripted mailbox exports.

Thankfully, with Exchange 2010 SP1, SP2 and SP3, Export-Mailbox is going the way of the dodo and new cmdlets for Mailbox imports and exports are available. Just like the New-MoveRequest cmdlet, the new import/export command use the Mailbox Replication Service to perform the move via one of the Client Access Servers giving performance benefits, such as ensuring the PST transfer doesn’t have to go via the machine with the Exchange Management Tools/Outlook installed, as was the case previously.

The main aim of this post is to give you an overview of how to use the new mailbox export cmdlets, and then show you how to put them to practical use, both at the command line and with a scheduled task for brick-level backups.

Getting it set up

The basic requirements for using the new feature are pretty straightforward. You need to use an account that’s a member of the organisational management groups, and have the “Mailbox Import Export” role assignment assigned to you or a role group you’re a member of. As the export is done at a CAS server (and if you’ve multiple CAS servers you can’t specify which one in each site will be used) you can’t specify a local drive letter and path – you must specify a UNC path to a network share that the “Exchange Trusted Subsystem” group has read/write access to.

Step One

Create a share on a server, and grant Exchange Trusted Subsystem read/write permission. In this example I’m using a share called Exports on a test server called Azua in my lab environment:

image

Step Two

Next, you’ll need to grant a user, or group, the Mailbox Import Export role assignment. You can do this using the Exchange Management shell with a single command. In this example, I’m granting my lab domain’s Administrator user the role assignment:

image

1
New-ManagementRoleAssignment –Role “Mailbox Import Export” –User AD\Administrator

After you’ve done this, close and re-open the Exchange Management shell, and you’re ready to go!

Exporting a Mailbox

At it’s simplest, use the New-MailboxExportRequest command with the –Mailbox parameter, to specify the mailbox to export along with the –FilePath parameter, to specify the PST file to create and export data to, e.g:

image
1
New-MailboxExportRequest -Mailbox Administrator -FilePath "\\AZUA\Exports\Administrator.pst"

In addition, there are some other useful options – such as –BatchName, which allows grouping of requests together, and –ContentFilter, which allows only certain content to be exported to the PST – useful for discovery purposes.  As usual, use the Get-Help New-MailboxExportRequest –detailed command to review the full plethora of options.

After submission of your requests, you can check progress, including the percentage complete, with the two Get-MailboxExportRequest and the Get-MailboxExportRequestStatistics commands. Pipe the former into the latter to get a listing:

image

1
Get-MailboxExportRequest | Get-MailboxExportRequestStatistics

After the requests complete, you can remove the requests in a similar fashion, using the Remove-MailboxExportRequest command:

image

1
Get-MailboxExportRequest | Remove-MailboxExportRequest
Performing mass exports

One benefit of Powershell is it’s very easy to put together commands enabling mass-exports of PST data with only a few commands. If you really wanted to, you could even use a Powershell script as a secondary brick-level backup!

The Basics

So to check out how to do this, let’s look at it’s simplest – backing up all the mailboxes (assuming it’s a full Exchange 2010 environment) to a single share:

image

1
foreach ($i in (Get-Mailbox)) { New-MailboxExportRequest -Mailbox $i -FilePath "\\AZUA\Exports\$($i.Alias).pst" }

In the above example, we’re simply performing a for-each loop through each mailbox and creating a new Mailbox Export Request, using the alias to build the name for the PST.

But – what if we’re in a mixed environment, and only want to target the Exchange 2010 mailboxes?

image

1
foreach ($i in (Get-Mailbox | Where {$_.ExchangeVersion.ExchangeBuild.Major -eq 14})) { New-MailboxExportRequest -Mailbox $i -FilePath "\\AZUA\Exports\${$i.Alias).pst" }

In this example above, now, we’ve added a clause to only select the mailboxes where the Exchange Major Build is 14 – Exchange 2010. Simple!

Moving on from such wide-targeting, you may want to target just a pre-defined list, using a CSV file. To do this, simply create a CSV file with the column “Alias”, and list the Mailbox alias fields you wish to export. Then, using the Import-CSV command we can use this CSV file to create the requests:

image

1
foreach ($i in (Import-Csv .\exports.csv)) { New-MailboxExportRequest -Mailbox $i.Alias -FilePath "\\AZUA\Exports\$($i.Alias).pst" }
Performing Mass Exports as a scheduled task

Now you’ve seen the basics of how easy it is to perform mass mailbox exports using the New-MailboxExportRequest command, I’ll finish off with a final example showing how to use this mass export feature as part of a scheduled task.

This script is aimed at backing up all the mailboxes on a single database, or a single server. After creating the requests, it waits for the requests to complete then, if you’ve specified a report directory, it will write reports showing completed and incomplete (i.e. failed!) requests. Finally it removes the requests it created.

To use the script, you need to alter the config section and specify either a server or a database, a share to export to, a share to write a report to after the process has completed and you can choose whether to remove each mailbox’s associated PST file or leave as-is at each export – merging the contents.

You’ll see the content of the script below and at the bottom of the post I’ve zipped it up along with a bootstrap CMD file you could use when setting up a schedule task. As always – use at your own risk and test out in your lab environment first. Happy Exporting!

1
2
# Exchange 2010 SP1 Mailbox Export Script
# Steve Goodman. Use at your own risk!

###############
# Settings #
###############

# Pick ONE of the two below. If you choose both, it will use $Server.
$Server = “server”
$Database = “”

# Share to export mailboxes to. Needs R/W by Exchange Trusted Subsystem
# Must be a UNC path as this is run by the CAS MRS service.
$ExportShare = “\\server\share”

# After each run a report of the exports can be dropped into the directory specified below. (The user that runs this script needs access to this share)
# Must be a UNC path or the full path of a local directory.
$ReportShare = “\\server\share”

# Shall we remove the PST file, if it exists beforehand? (The user that runs this script needs access to the $ExportShare share)
# Valid values: $true or $false
$RemovePSTBeforeExport = $false

###############
# Code #
###############

if ($Server)
{
if (!(Get-ExchangeServer $Server -ErrorAction SilentlyContinue))
{
throw “Exchange Server $Server not found”;
}
if (!(Get-MailboxDatabase -Server $Server -ErrorAction SilentlyContinue))
{
throw “Exchange Server $Server does not have mailbox databases”;
}
$Mailboxes = Get-Mailbox -Server $Server -ResultSize Unlimited
} elseif ($Database) {
if (!(Get-MailboxDatabase $Database -ErrorAction SilentlyContinue))
{
throw “Mailbox database $Database not found”
}
$Mailboxes = Get-Mailbox -Database $Database
}
if (!$Mailboxes)
{
throw “No mailboxes found on $Server”
}

if (!$Mailboxes.Count)
{
throw “This script does not support a single mailbox export.”
}

# Pre-checks done

# Make batch name
$date=Get-Date
$BatchName = “Export_$($date.Year)-$($date.Month)-$($date.Day)_$($date.Hour)-$($date.Minute)-$($date.Second)”

Write-Output “Queuing $($Mailboxes.Count) mailboxes as batch ‘$($BatchName)'”

# Queue all mailbox export requests
foreach ($Mailbox in $Mailboxes)
{

if ($RemovePSTBeforeExport -eq $true -and (Get-Item “$($ExportShare)\$($Mailbox.Alias).PST” -ErrorAction SilentlyContinue))
{
Remove-Item “$($ExportShare)\$($Mailbox.Alias).PST” -Confirm:$false
}
New-MailboxExportRequest -BatchName $BatchName -Mailbox $Mailbox.Alias -FilePath “$($ExportShare)\$($Mailbox.Alias).PST”
}

Write-Output “Waiting for batch to complete”

# Wait for mailbox export requests to complete
while ((Get-MailboxExportRequest -BatchName $BatchName | Where {$_.Status -eq “Queued” -or $_.Status -eq “InProgress”}))
{

sleep 60
}

# Write reports if required
if ($ReportShare)
{
Write-Output “Writing reports to $($ReportShare)”
$Completed = Get-MailboxExportRequest -BatchName $BatchName | Where {$_.Status -eq “Completed”} | Get-MailboxExportRequestStatistics | Format-List
if ($Completed)
{
$Completed | Out-File -FilePath “$($ReportShare)\$($BatchName)_Completed.txt”
}
$Incomplete = Get-MailboxExportRequest -BatchName $BatchName | Where {$_.Status -ne “Completed”} | Get-MailboxExportRequestStatistics | Format-List
if ($Incomplete)
{
$Incomplete | Out-File -FilePath “$($ReportShare)\$($BatchName)_Incomplete_Report.txt”
}
}

# Remove Requests
Write-Output “Removing requests created as part of batch ‘$($BatchName)'”
Get-MailboxExportRequest -BatchName $BatchName | Remove-MailboxExportRequest -Confirm:$false

Command file contents:

1
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -command ". 'c:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto; .\MassExport.ps1"

Download as ZIP

292 thoughts on “Using the Exchange 2010 Mailbox Export features for Mass Exports to PST files

  1. Hello Steve,

    thany you very much for this tutorial.
    It saves so much time – GREAT!!
    Unfortunately i have a little trouble with the “Queued Status.”
    I can start the Mailbox-Export, but nothing happens. The Status of MailboxExport is still Queued.
    Is there a way to force the Exchange to do the Jobs?

    Help’s for my problem would be great,
    Martin

      • Dear Steve,

        I am fresh in Exchange 2010, how can I export a mailbox to PST Weekly, say export 1stSaturday.pst, 2ndSaturday.pst…..after delete the content ?

          • Hello,
            Just incase anyone was curious

            Original

            New-MailboxExportRequest -BatchName $BatchName -Mailbox $Mailbox.Alias -FilePath “$($ExportShare)\$($Mailbox.Alias).PST”

            Edited:

            New-MailboxExportRequest -BatchName $BatchName -Mailbox $Mailbox.Alias -FilePath “$($ExportShare)\$($date.Year)-$($date.Month)-$($date.Day)-$($Mailbox.Alias).PST

            worked for me.

  2. Great tutorial, thank you! I was just curious, would this mass export powershell script work to export Exchange 2007 mailboxes to PST? We currently still use exchange 2007

    Thanks!

    • Hi Rick,

      Unfortunately not – the export technique on Exchange 2007 uses export-mailbox and requires Outlook installed on the server/administrative workstation.

      Steve

  3. Hi Steve,

    Great script but I have a problem running the massexport.cmd as a scheduled task. When I execute the massexport.cmd manually, there is no problem and the mail export is running and populating the backup share. However, when running as a scheduled task, no data is getting updated. The change date of the PST-backup files are unchanged.
    Do you have a tip on how to get this running as a scheduled task?

    I am running the task with highest priveliges set.

    Thanks.

    • Hiya,

      I’m aware this can be an issue. I’d recommend getting it running from a .cmd file (that launches PowerShell -c with the full command) then scheduling that.

      Steve

    • Just add Parameters “-NonInteractive -WindowStyle Hidden” to command line

      C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NonInteractive -WindowStyle Hidden -command “. ‘c:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1’; Connect-ExchangeServer -auto; .\Backup_Exchange.ps1”

  4. Thank you very much Steve! using the export cmd with csv has enabled me to remove well over 300 unused accounts from exchange in a few easy steps!!!!!!! very much appreciated

    James

  5. Pingback: Exchange 2010 Mailbox Export | Hakan Çakıroğlu Kişisel Blog

  6. Pingback: flaphead - #Exchange Server 2010 SP1 Beta Links

  7. Pingback: A look back at 2011, and a look forward to 2012

  8. help everyone .
    we had problems with domain and exchange and at the end we built new structure so
    is it possible to import mailbox database from ex2010 to another new installed ex2010
    because i know that database guid does not match .
    any workaround or tools to do such transfer

  9. Very useful site, bookmarked.

    One question, is it possible to use this with the SMTP name not the alias ?
    I am getting the following error

    Cannot process argument transformation on parameter ‘Mailbox’. Cannot convert the “@{SMTP =darren.martin@domain.com}” value of type “Deserialized.System.Management.Automation.PSCustomObject” to type “Microsoft.Exchange.Configurati
    on.Tasks.MailboxOrMailUserIdParameter”.
    + CategoryInfo : InvalidData: (:) [New-MailboxExportRequest], ParameterBindin…mationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,New-MailboxExportRequest

    Is it because of the full stop in the smtp i.e darren.martin@domain.com ?

    Many thanks for any help.

    Darren

  10. Pingback: Exchange 2010 Mailbox Kurtarma | Hakan Çakıroğlu Kişisel Blog

  11. Having trouble using the “foreach ($i in (Get-Mailbox | Where {$_.ExchangeVersion.ExchangeBuild.Major -eq 14})) { New-MailboxExportRequest -Mailbox $i -FilePath “\\AZUA\Exports\${$i.Alias).pst”… when i execute it, all i get is double carrots like it’s needing some parameters… Any help?

    • I think, you have mistake there ${$i.Alias).pst” – it should be $($i.Alias)
      and you missed “}” on the end of script

  12. I am using this script at the moment and it’s working very well on a hosted exchange box. I would like to add an option to put the PST in a folder based on the Organization Name, so it creates a folder for that Organization and puts their PST files into that folder. Is it possible to do this? if so what would i need to change in the script?

  13. Hi, Steve!

    I have some problem with export folder “Conversation History” (Lync 2010 conversation history)

    I tried commands:
    New-MailboxExportRequest -Mailbox alias -FilePath “\\server\Export$\alias.pst” -IncludeFolders “#CommunicationHistory#”
    where “CommunicationHistory” well-known folder (from help this command)
    Result: “The provided IncludeFolders or ExcludeFolders value is invalid. Folder alias ‘CommunicationHistory’ is invalid.”

    Also I tried:
    New-MailboxExportRequest -Mailbox alias -FilePath “\\server\Export$\alias.pst” -ContentFilter {MessageKind -eq IM}
    Result:”The provided ContentFilter value is invalid. ContentFilter is invalid. Invalid filter syntax. For a description of the filter parameter syntax see the command help.”

  14. Hi, Steve.

    Great work, and thank you for sharing.

    I can export individual mailboxes just fine, but have a situation now where an OU hs been created and disabled user accounts placed into it.

    They cannot be deleted until their individual mailboxes are exported to .pst files for use by HR if necessary.

    My knowledge of scripting is right up there with my knowledge of rocket science, and I’m not up tosped on rocket science, either! 🙂

    Is it possible to modify your script example so that it will export the mailboxes for all users of a specified OU within Active Directory, e.g. “Disbled,” for example

    Thanks,
    Bill

  15. Thank you very much Steve! Using the above script on two SBS 2011 servers now and it works great 🙂

    /Tommie

  16. Pingback: Exchange 2010 PST export | dragi77

  17. Problem With export Mailboxes from an Database.

    When I Run the Script only 2 of 6 MAilboxes are Queued for export. Why are the other mailboxes are not exported.

    THX

    Jochen

    • Hi Jochen,

      I can’t say for sure. It might be worth attempting to export the mailboxes manually. In general this script seems to work well for a lot of people with few issues (most commonly getting the script running)

      Steve

  18. Problem with Export e-mails from journaling mailbox to pst file

    Hello

    I using Exchange 2010 SP1 RU5.
    When I export e-mail messages from journaling mailbox to pst file, all e-mails are empty.

    In journal mailbox I’ve checked e-mail.
    This e-mail (journal report) include orginal e-mail message. This message include some body text and attachements.

    When I open pst file and open this e-mail message (journal report) there is orginal e-mail message, but when i open it there is only attachement.

    Do you know why body text was removed?

    Thank you very much for help.

    Tomasz

    • I’m having the same issue with 2010 sp2, the emails have size to them but the body has nothing. Even when I look at these in OWA it’s the same

    • Hi Tomasz,

      To be frank, I don’t know. I’ve heard of a number of problems that the PST export facilities can have in different circumstances. If you have PSS it may be worth raising a call, so if its a bug it can be fixed.

      Steve

  19. Thank you VERY much for the syntax to get this procedure completed. I spent a while trying this and variations of it to get the job done: Export-Mailbox -Identity user -PSTFolderPath d:\user.pst to no avail. I have bookmarked your site as VERY IMPORTANT 🙂

  20. Hi

    I add

    #Add Exchange features.
    Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010

    Just under the Code section for Exchange 2010. Then you can run the script directly without errors.

    Just running script now, Need to Mod to be schedule Task and also email results but should not be to hard.

    Thanks

  21. Hi there

    I spent some times on some backups problems (symantec and exchange related) when I came across a strange problem: modifying some values in the MSExchangeMailboxReplication.exe.config (to allow more mailboxes to be exported at one go) messed my PST export 🙁

    Do you think it could be related to my problem described above (see my previous comment)?
    I am trying to get some information about how to use the MSExchangeMailboxReplication.exe.config file, because it seems very fussy…

    thanks

  22. Hi

    thanks for the script, we are using it since we started our migration, some months ago (took some times, not almost done). Anyway, everything went on well until some times (I can’t be precise). Now, whenever the script is ran (full admin rights), it starts, put about 150 mailboxes in queue and I got bunch of random errors like
    “couldn’t connect to the source mailbox”
    “Categorie info: Not Specified: (0:Int32) [new-mailboxexportrequest ], RemotePermanentException”
    “FullyQualifiedErrorId : C2DA5FB1,Microsoft.Exchange.Management.RecipientTasks.NewMailboxExportRequest”

    I can export about 150 mailboxes (on 300, currently) but that’s all.
    please note: roles (CAS,HUB,MB) are installed on the same server, no DAG, just a legacy 2003 server still running, since we are in the process of migration. Script is ran from the server itself, to a local disk (through a share).

    I tried to “set-executionpolicy unrestricted” (to be more permissive), but no luck.
    I tried, then, to select my first database (I got 5 of them) rater than my server: now it put 200+ mailboxes in queue with no problem.

    If I can’t fix the problem, I’ll workaround it with a foreach in the beginning of your script. It’s very strange, though.
    I have tried this:
    “- Editing the value of MaxTotalMovesPerMRS = “100” to “500” did the trick…”
    via:
    http://social.technet.microsoft.com/Forums/en-US/exchange2010/thread/c0cb3ed8-f964-4c63-acd2-344a26088d39

    but it did not help either…

  23. Hi,
    Thanks a lot for the great help.
    I’m trying to use the script to export all the mailbox in a specific database.
    Can you please provide me with the required code
    thanks a lot

  24. Hi,

    I have a problem running the massexport.cmd as a scheduled task. When I execute the massexport.cmd manually, there is no problem and the mail export is running and populating the backup share. However, when running as a scheduled task, no data is getting updated. The change date of the PST-backup files are unchanged.

    Do you have a tip on how to get this running as a scheduled task?

    Thanks.

    • Hey Steve Nice Script

      But I have the same issue as Geir .
      I Placed the 2 file in \v14\bin\ directory
      Give domainadmins full security richts on the 2 files .
      When i start the cmd file manualy is starts the script , but wen i try to start the cmd file from out the windows scheduler nothing happens.

  25. Pingback: Using the Exchange 2010 SP1 Mailbox Export features for Mass Exports to PST files « M.Ufuk TATLIDIL

  26. Thanks for the guide.

    I’m having an issue, no matter what I do I can’t get the permissions right on the share I want to write to. The user I’m using for the export is a member of doman user, domain admin, Exchange Trusted Subsystem and Organization Managment. I have also added the Exchange Trusted Subsystem read write permissions to my share location.

    I’m getting the ‘Access to the Path \\Server\Share\name.pst’ is denied error.

    I know it’s something simple, any ideas? Thanks

    • The user shouldn’t need the permissions as it doesn’t perform the move. The Exchange server itself (using the SYSTEM account) does. The Exchange server must be a member of that group so I would double check it is (it should be!) and double check the share permissions and share NTFS permissions. Also for troubleshooting, try allowing Everyone access.

      Steve

      • Hi Steve,Thnks for the script
        In my requirment, i have to create a script which export a single mailbox on daily basis and the exported pst name should be unique(pst format could be DD-MM-YY.pst). And after mailbox export the mails from the mailbox should be deleted automatically so that the same mails will not be exported in next day export. Can you please guide me in writing such script

  27. Hi !

    No matter how or how hard I try, I can´t get access to the Export-Mailbox command.

    Im running a SBS2011, i have outlook 2010 x64 installed, and ive tried reinstalling the management tools .. What am I missing ?

    I’ve tried elevated Powershell, adding users to the admin-accounts, trusted subsystem and on and on. The cmdlet still manages to stay hidden/gone.

    • Hi Jesper,

      The Export-Mailbox command is replaced in Exchange 2010 SP1 and above by the New-MailboxExportRequest command. Outlook is not required on the server. This guide should explain how to use the new cmdlets.

      Steve

  28. Hi Steve, so following the conversation on the MSExchange list,
    1. I dont think it will work to populate the $Server variable with more than one server (DAG partners, both active and passive mailbox server). Just wondering how this can be overcome without scheduling two separate scripts?

    2. Polling exchange event log when the ps1 is run, I’m seeing quite a number of errors wrt: corrupted items during the mailboxexport operation. Will inserting a badlimit count work to stop this?

    Thanks,

    New-MailboxExportRequest -BatchName $BatchName -Mailbox $Mailbox.Alias -FilePath “$($ExportShare)\$($Mailbox.Alias).PST” -BadItemLimit 100

    • Hi David,

      Sorry for the delay with the reply.The script is rather basic when it comes to servers but if you have a specific requirement it could be modified. For example you could add the following at the top of the script:

      $Servers=”server1″,”server2″
      foreach ($Server in $Servers) {

      and add the following at the end of the script:

      }

      The errors with corrupted items may be skipped with that option but I would investigate for an underlying cause, personally.

      Steve

  29. I got the mailbox to pst export function working great….

    Since we also have a couple of important public folders, some containing mail, some containing shared contacts, etc… we would love to export those (all) public folders to PST to.

    Can this also be done with the powershell script?

    • Hiya,

      This can’t currently be done with the mailbox export cmdlets using a script. The best suggestion for public folder database backup would be to use a proper third part backup utility or perhaps add another PF replica and dismount for file-level backup, then remount.

      Steve

  30. i can not able to execute new-exportmailboxrequest command more than 9 time any mail box . just for remember that when we execute the command it show like this :

    Name Mailbox Status
    ——- ——— ——–
    Mailboxexport1 information about mailbox queued

    after next time a repeate the same above command it will again come like :

    Name Mailbox Status
    ——- ——— ——–
    Mailboxexport2 information about mailbox queued

    till

    Name Mailbox Status
    ——- ——— ——–
    Mailboxexport9 information about mailbox queued

    all the above command execute fine.

    My problem is when i try same command for more than 9 on any mailbox i got the error message like this:

    “the name must unique per mailbox. there is not a default name available for a new request owned by mailbox.”

    Your prompt reply very appreciate.

    Thanks in advance

    • Ali, I had the same problem. Need to run the command to get rid of the previous requests before running your new one:
      Get-MailboxExportRequest | Remove-MailboxExportRequest -Confirm:$false

  31. i need help regarding the export command. when i export any mail box more then 9 time. i got the error message is

    “the name must unique per mailbox. there is not a default name available for a new request owned by mailbox”

    when execute New-Mailboxexportrequest command , the show counter like this:

    Name Mailbox export
    ——-
    Mailbox-export

  32. Hi Steve,

    I just tried using your script on an sbs 2011 machine running exchange 2010 but i get the following error.

    File C:\Scripts\MassExport.ps1 cannot be loaded. The file C:\Scripts\MassExport.ps1 is not digitally signed. The script
    will not execute on the system. Please see “get-help about_signing” for more details..
    At line:1 char:122
    + . ‘c:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1’; Connect-ExchangeServer -auto; .\MassExport
    .ps1 <<<<
    + CategoryInfo : NotSpecified: (:) [], PSSecurityException
    + FullyQualifiedErrorId : RuntimeException

    Any ideas why this will not run?

    Many Thanks,
    James

    • Hi James,

      Try (from an administrator/elevated Powershell session):

      Set-ExecutionPolicy Unrestricted

      And then attempt to run the script.

      Alternatively, if you want to be more secure:

      Set-ExecutionPolicy RemoteSigned

      Then open the file’s Zone.Identifier alternate data stream in notepad (with the quotes)

      notepad “MassExport.ps1:Zone:Identifier”

      And ensure the contents are similar to below:

      [ZoneTransfer]
      ZoneId=0

      This should set the script so the OS thinks it originated locally (more info here http://blogs.msdn.com/b/powershell/archive/2007/03/07/how-does-the-remotesigned-execution-policy-work.aspx)

      Steve
      Steve

      • Ok so now the script gets past that error but then says the following

        Security Warning
        Run only scripts that you trust. While scripts from the Internet can be useful, this script can potentially harm your
        computer. Do you want to run C:\Scripts\MassExport.ps1?
        [D] Do not run [R] Run once [S] Suspend [?] Help (default is “D”): ?
        D – Do not run the script from this publisher now, and continue to prompt me to run this script in the future.
        R – Run the script from this publisher now, and continue to prompt me to run this script in the future.
        S – Pause the current pipeline and return to the command prompt. Type exit to resume execution when you are done.

        I can select run once but that would need to be done manually every time the script runs.

        Any ideas how i could get around that?

  33. Hi Steve,

    Can you please advise if it’s possible to convert Exchange 2010 mails (please note it’s not Exchange 2010 SP1 here) to PST.

    Thanking you in advance.

    Rgds,

    Sylaish.

  34. Pingback: Tech Tip: Exporting Mailboxes in Exchange 2010 SP1 « Recreational Reading

  35. When I run the script it appears to execute without error but I am not getting any pst files as a result. There are no error messages in event viewer. There was no error message in powershell [after I modified the cmd file to point to the location of the ps1 file]. Does it take a really long time [more than an hour] to produce even a single pst? Is there a way to monitor the progress?

    • Update: I am able to export a single mailbox to a pst file but still no joy with the script. I did modify the ps1 file variables for $Server ; $ExportShare and $ReportShare as required. I also ran the cmdlet [New-ManagementRoleAssignment –Role “Mailbox Import Export” –User AD\Administrator] adjusted for my domain. I don’t see anything else needed in order for this to work. Also, I reread the post above and found the cmdlet for checking the status [Get-MailboxExportRequest | Get-MailboxExportRequestStatistics]. This says nothing is happening after running the script. I hope you can help me resolve this as this would be really cool to get working ;). Thanks much in advance!!

        • I don’t. The script appears to run and complete without error. But nothing actually happens. There are no events posted in the event viewer. There are no logs written in the file share. Can you think of any other place to look for clues? Thanks again.

    • Question: I am trying to export multiple pre-listed mailboxes in a export.csv file, located on various DBs. My question is how do I specify the location of the export.csv in this command?

      foreach ($i in (Import-csv .\exports.csv)) {New-MailboxExportRequest -mailbox $i.alias -FilePath “\\brockhaus\ex2010exports$\$($i.alias).pst”}

Comments are closed.