?
Solved

Export Mail by Date Range to PST then Delete

Posted on 2014-04-02
5
Medium Priority
?
2,978 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 42

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

After hours on line I found a solution which pointed to the inherited Active Directory permissions . You have to give/allow permissions to the "Exchange trusted subsystem" for the user in the Active Directory...
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Suggested Courses

770 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