Solved

Export Mail by Date Range to PST then Delete

Posted on 2014-04-02
5
2,660 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
  • 2
  • 2
5 Comments
 
LVL 35

Accepted Solution

by:
Joseph Daly earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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 38

Expert Comment

by:Adam Brown
Comment Utility
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
Comment Utility
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 Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Utilizing an array to gracefully append to a list of EmailAddresses
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
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…
how to add IIS SMTP to handle application/Scanner relays into office 365.

763 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

7 Experts available now in Live!

Get 1:1 Help Now