Frank_Day
asked on
Export Mail by Date Range to PST then Delete
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
That being said test, test, test before you put into action.
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
ASKER
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.
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.
You can export the items and then delete them by using following command:
Above command will export all items from all folders which are dated from 01/01/2014 to 03/31/2014 and will export them to a PST and delete them from the mailbox.
There are a few other export options:
Alternatively, you can also use Stellar EDB to PST Converter to export selected items for a particular date range. For free demo version, check this link: https://www.stellarinfo.com/email-repair/edb-pst-converter.php
Export-Mailbox -marshal@test.local -StartDate "01/01/2014" -EndDate "03/31/2014"” -PSTFolderPath C:\Backup\marshal.pst -deletecontent
Above command will export all items from all folders which are dated from 01/01/2014 to 03/31/2014 and will export them to a PST and delete them from the mailbox.
There are a few other export options:
- Specific keywords in the subject -SubjectKeywords
- Specific keywords in the content –ContentKeywords
- Specific folder -IncludeFolders ‘\Sent Items’
- Specific attachment name or extension-AttachmentFilena
mes
Alternatively, you can also use Stellar EDB to PST Converter to export selected items for a particular date range. For free demo version, check this link: https://www.stellarinfo.com/email-repair/edb-pst-converter.php
ASKER
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.