Solved

Exchange powershell mass exporting to PST

Posted on 2016-08-16
5
46 Views
1 Endorsement
Last Modified: 2016-08-17
I am trying to build a little powershell script that will export all users mailboxes in a particular OU to PST on a file server but i am having a little difficulty sperating the information i need to automate.

import-module activedirectory
$ou = "OU=Window Lickers,DC=domain,DC=Local"
$Users = Get-ADUser -ResultSetSize 3000 -SearchBase $ou -filter * | ForEach-Object {$_.Name, $_.UserPrincipalName}
foreach ($user in $users)
{
##In here i want to be able to export each mailbox to a specific path. I was hoping to use this but it doesnt seem to work.
New-MailboxExportRequest -Mailbox $_.UserPrincipalName -FilePath "\\vm1\archives\NewArchives\" $_.Name
}


Any help on this is appreciated.
1
Comment
Question by:CaptainGiblets
  • 2
  • 2
5 Comments
 
LVL 16

Accepted Solution

by:
Ivan earned 250 total points
ID: 41757641
Hi,

maybe you can try with this, running from Exchange Shell.

$Export = Get-Mailbox -OrganizationalUnit Test
$Export|%{$_|New-MailboxExportRequest -FilePath "\\servername\pst\$($_.alias).pst"}

It is a modification from https://social.technet.microsoft.com/wiki/contents/articles/13908.bulk-export-mailboxes-to-pst-in-exchange-2010.aspx

Regards,
Ivan.
0
 
LVL 7

Assisted Solution

by:David Sankovsky
David Sankovsky earned 250 total points
ID: 41757647
I have something that works well for hosted exchange.
If said OU happens to have a different UPN, can try this:

$Export=Get-Mailbox -ResultSize unlimited | where {$_.primarysmtpaddress -like "*@upn.tld"}
foreach ($i in ($Export)) {New-MailboxExportRequest -Mailbox $i -Filepath "\\servername\sharename\$($i.PrimarySmtpAddress).pst" }

Open in new window

1
 
LVL 7

Expert Comment

by:Senior IT System Engineer
ID: 41758706
David,

Is that powershell command also exports the archived email as well to PST ?
0
 
LVL 7

Expert Comment

by:David Sankovsky
ID: 41758902
Is that powershell command also exports the archived email as well to PST ?

No, only the mailbox itself, to export the archives as well, modify the script like so:

$Export=Get-Mailbox -ResultSize unlimited | where {$_.primarysmtpaddress -like "*@upn.tld"}
foreach ($i in ($Export)) {New-MailboxExportRequest -Mailbox $i -Filepath "\\servername\sharename\$($i.PrimarySmtpAddress)_archive.pst" -IsArchive }

Open in new window

1
 
LVL 7

Expert Comment

by:Senior IT System Engineer
ID: 41758995
You see Awesome David :-)
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lotus Notes – formerly IBM Notes – is an email client application, while IBM Domino (earlier Lotus Domino) is an email server. The client possesses a set of features that are even more advanced as compared to that of Outlook. Likewise, IBM Domino is…
Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
In this video we show how to create an Accepted Domain in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Mail Flow >> Ac…
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…

939 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

4 Experts available now in Live!

Get 1:1 Help Now