| | |

Bulk export Mailbox to .PST using PowerShell

Bulk export Mailbox to .PST using PowerShell

I recently received a request to bulk export mailboxes to .pst , to help mysef i have created this small script to import from csv and then kick off the export request.

file can be downloaded Here

Code:

#Created By: Shaun Hardneck
#http://thatlazyadmin.com
#Freebies :)
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn;
Import-Csv 'C:\Softlib\Users.csv' |
ForEach{
try {
#Get-Mailbox -Identity $_.name |
New-MailboxExportRequest -Mailbox $_.name -FilePath "\\auh2fs02\PST\$_.name.pst" -ErrorAction stop
}
catch [system.exception]
{
Write-Host "$_.name" -ForegroundColor Red
}
Finally
{
}}

 

#ThatLazyAdmin

Similar Posts

2 Comments

  1. is there a way to export mailbox on 2010 to .csv file with mail header information also ? Inbox and Sent items ?

Leave a Reply

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