?
Solved

Export Mail by Date Range to PST then Delete

Posted on 2014-04-02
5
Medium Priority
?
3,102 Views
Last Modified: 2014-04-02
I need help with a Powershell script.
I have Exchange Server 2007 sp3. with 30+ mailboxes.
I have installed the Exchange Tools on a Windows 7 32-bit workstation.

I would like to export select single mailboxes to pst files, including all folders and subfolders by date range for archival purposes, THEN Remove/Delete that same date range from their Mailbox.

What would the correct syntax be for this?

I'm successfully using the following to export by date range.  I just don't know how to make it delete upon completion.
Export-Mailbox -Identity <mailbox-alias> -StartDate "01/01/2014" -EndDate "03/31/2014" -PSTFolderPath c:\pstfile
0
Comment
Question by:Frank_Day
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 35

Accepted Solution

by:
Joseph Daly earned 1500 total points
ID: 39973180
You would use the -deletecontent switch.  Obviously it goes without saying to test this on a test account before your actual users.

http://technet.microsoft.com/en-us/library/aa998579%28v=exchg.80%29.aspx

Export-Mailbox -Identity <mailbox-alias> -StartDate "01/01/2014" -EndDate "03/31/2014" -PSTFolderPath c:\pstfile  -deletecontent
0
 

Author Comment

by:Frank_Day
ID: 39973225
I've seen -deletecontent but I'm confused on how to use it.  It seems to always be in context with attachments, subject headings, etc.

If used as you have typed, would it only delete the date range previously stated?  Or does it need further input?

As you may have guessed, I know NOTHING about scripting.
0
 
LVL 35

Expert Comment

by:Joseph Daly
ID: 39973251
Im on 2010 so I cant test for you but yes this should only delete the messages that match the criteria specified in the command.

That being said test, test, test before you put into action.
0
 
LVL 43

Expert Comment

by:Adam Brown
ID: 39973256
The -deletecontent switch might only work if you use the -targetmailbox and -targetfolder switches. At least, that seems to be how the description of the switch is worded. But definitely test it out :D
0
 

Author Comment

by:Frank_Day
ID: 39973447
UpDate, It Worked !

Export-Mailbox -Identity <mailbox-alias> -StartDate "01/01/2014" -EndDate "03/31/2014" -PSTFolderPath c:\pstfile  -deletecontent

This did in fact Export and then Delete all the folders and subfolders within the given date range ONLY.
0

Featured Post

Are You Ready for GDPR?

With the GDPR deadline set for May 25, 2018, many organizations are ill-prepared due to uncertainty about the criteria for compliance. According to a recent WatchGuard survey, a staggering 37% of respondents don't even know if their organization needs to comply with GDPR. Do you?

Question has a verified solution.

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

I don't pretend to be an expert at this, but I have found a few things that are useful. I hope that sharing them here will help others, so they will not have to face some rather hard choices. Since I felt this to be a topic of enough importance and…
One-stop solution for Exchange Administrators to address all MS Exchange Server issues, which is known by the name of Stellar Exchange Toolkit.
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
This video discusses moving either the default database or any database to a new volume.

649 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