Exchange 2010 Power Shell Archive
Hi I want to archive a users mailbox to a PST File using the Exchange 2010 Power Shell. Lets say i wanted to archive all emails for userA from before 30/06/11 what would the command be? Any help appreciated. ThanksBen Weinberg Prime-Networks www.prime-networks.co.uk Please post the resolution to your issue so that everyone can benefit Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
May 22nd, 2012 10:13am

Hi, Use this cmdlet to export as PST: Export-mailbox "mailboxname" -PSTFolderPath C:\temp\ -DeleteContent -endDate 06/30/2011 If you want to delete the contents run the following command too: Search-Mailbox -Identity "mailboxname"-SearchQuery "Received:<$('30.06.2011')" -DeleteContentRegards from www.windowsadmin.info | www.blog.windowsadmin.info
Free Windows Admin Tool Kit Click here and download it now
May 22nd, 2012 11:12am

By archive you mean to export to pst? If so export to PST first then delete. Exchange 2010 SP1 no longer has the delete content switch for the new-mailboxexportreqeust cmdlet. New-MailboxExportRequest -ContentFilter {(Received -lt '03/06/2011')} -Mailbox "jyoung" -FilePath "\\dcexmailp01\PST Dumps\jyoung.pst" search-mailbox userA -SearchQuery "Received:> $('3/6/2011')" -DeleteContentJames Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com
May 22nd, 2012 11:13am

I would use export-mailbox (2007 or 2010 pre SP1) for this http://technet.microsoft.com/en-us/library/aa998579.aspx or New-MailboxExportRequest (2010 SP1 and later) http://technet.microsoft.com/en-us/library/ff607299.aspx 2007 to 2010 pre SP1 method Export-Mailbox -Identity Domain\UserA -PSTFolderPath "C:\UserA.PST" -EndDate "06/29/2011" I set the end date to the day before because end date is used for that day or earlier. You can also use a time constraing on StartDate and EndDate if needed. 2010 SP1 and later method: New-MailboxExportRequest -Mailbox UserA -FilePath "\\SERVER\Share\UserA.pst" -ContentFilter {(Received -lt "06/30/2011")} There are some setup items that must be completed before you can do either method, so here are some links. Exchange 2007: http://technet.microsoft.com/en-us/library/bb266964(v=EXCHG.80).aspx Exchange 2010 Pre SP1 : http://www.howexchangeworks.com/2009/08/where-is-exportimport-cmdlets-in.html Exchange 2010 SP1 and Later: http://technet.microsoft.com/en-us/library/ee633455.aspx http://exchangeserverpro.com/export-mailboxes-exchange-server-2010-sp1
Free Windows Admin Tool Kit Click here and download it now
May 22nd, 2012 11:23am

I am using exchange 2010 SP1 so this command looks best: New-MailboxExportRequest -Mailbox UserA -FilePath "\\SERVER\Share\UserA.pst" -ContentFilter {(Received -lt "06/30/2011")} But that exports and leaves the data behind, how do i remove the same data once the export is complete? Ben Weinberg Prime-Networks www.prime-networks.co.uk Please post the resolution to your issue so that everyone can benefit Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
May 22nd, 2012 11:33am

The second cmdlet in my orig post :) search-mailbox userA -SearchQuery "Received:> $('3/6/2011')" -DeleteContent James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
May 22nd, 2012 11:57am

Ahh, didn't realize you wanted that as well, you have to use search-mailbox with delete content since deletecontent is no longer part of the new-mailboxexportrequest. http://technet.microsoft.com/en-us/library/dd298173.aspx Search-Mailbox -Identity UserA -SearchQuery 'received:<6/30/2011' -DeleteContent I would suggets you test this on a mailbox to get the criteria right. You can use a -LogOnly switch, but you have to set a -TargetMailbox for the log file to be sent to.
May 22nd, 2012 12:12pm

Hmm I tried to run the first command, the command is correct, but the job failed and im not sure how to find out why?Ben Weinberg Prime-Networks www.prime-networks.co.uk Please post the resolution to your issue so that everyone can benefit Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
May 22nd, 2012 12:31pm

I have just realised... If i am not mistaken you need to have outlook installed on the machine you are running these commands from? Is that right?Ben Weinberg Prime-Networks www.prime-networks.co.uk Please post the resolution to your issue so that everyone can benefit Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
May 22nd, 2012 12:48pm

Ok.. So running this command shows me why it failed: Get-MailboxExportRequest -Status Failed | Get-MailboxExportRequestStatistics -IncludeReport | Format-List > AllExportReports.tx The report has the below error, but i am not sure what the problem with the date is? FailureCode : -2146233088 FailureType : InvalidContentFilterPermanentException FailureSide : Message : Error: ContentFilter is invalid. The value "30/06/2011 00:00:00" could not be converted to type System.DateTime. --> The value "30/06/2011 00:00:00" could not be converted to type System.DateTime. FailureTimestamp : 22/05/2012 17:28:23 FailureContext : Ben Weinberg Prime-Networks www.prime-networks.co.uk Please post the resolution to your issue so that everyone can benefit Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
May 22nd, 2012 1:07pm

Strange If i change the date to: 07/01/2011 the command works! Why doesnt it like 30/06/2011 (I also tried 06/30/2011 and it still didnt like it) Ben Weinberg Prime-Networks www.prime-networks.co.uk Please post the resolution to your issue so that everyone can benefit Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
May 22nd, 2012 1:27pm

Per the cmdlet must be in that convention. Filterable Properties for the -ContentFilter Parameter http://technet.microsoft.com/en-us/library/ff601762.aspx James Chong MCITP | EA | EMA; MCSE | M+, S+ Security+, Project+, ITIL msexchangetips.blogspot.com
Free Windows Admin Tool Kit Click here and download it now
May 22nd, 2012 1:40pm

Hello Ben, The value "30/06/2011 00:00:00" could not be converted to type System.DateTime. You need input the date-time format the same as you configured on your Exchange Server. Thanks, Evan Liu TechNet Subscriber Support in forum If you have any feedback on our support, please contact tngfb@microsoft.com Evan Liu TechNet Community Support
May 22nd, 2012 11:29pm

Evan I tried to, it doesn't matter if i use 30/06/2011 or 06/30/2011 I still get the same error.Ben Weinberg Prime-Networks www.prime-networks.co.uk Please post the resolution to your issue so that everyone can benefit Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
May 23rd, 2012 3:56am

Hi Ben Follow this way to have a try: $Time=[DateTime]06/30/2011 00:00:00" New-MailboxExportRequest -Mailbox UserA -FilePath "\\SERVER\Share\UserA.pst" -ContentFilter {(Received -lt $Time)} If you still get error, please post the exact error information in your next post. Thanks, Evan Liu TechNet Subscriber Support in forum If you have any feedback on our support, please contact tngfb@microsoft.com Evan Liu TechNet Community Support
May 23rd, 2012 11:22pm

Hi Ben Follow this way to have a try: $Time=[DateTime]06/30/2011 00:00:00" New-MailboxExportRequest -Mailbox UserA -FilePath "\\SERVER\Share\UserA.pst" -ContentFilter {(Received -lt $Time)} If you still get error, please post the exact error information in your next post. Thanks, Evan Liu TechNet Subscriber Support in forum If you have any feedback on our support, please contact tngfb@microsoft.com Evan Liu TechNet Community Support
Free Windows Admin Tool Kit Click here and download it now
May 23rd, 2012 11:26pm

Hello Ben, Any updates on this issue? Thanks, Evan Liu TechNet Subscriber Support in forum If you have any feedback on our support, please contacttngfb@microsoft.com Evan Liu TechNet Community Support
May 24th, 2012 9:38pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics