Solved

Exchange powershell mass exporting to PST

Posted on 2016-08-16
5
49 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

Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
In this video we show how to create an Address List 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 Organization >> Ad…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

809 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