?
Solved

Need help with Powershell Script for Exchange

Posted on 2010-08-24
12
Medium Priority
?
250 Views
Last Modified: 2012-05-10
I need a power-shell script that can take an existing users mailbox, and copy the folder structure of the mailbox, while only copying the messages in the various folders that are older than a certain date.

Thanks
0
Comment
Question by:Methodman85
[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
  • 6
  • 5
12 Comments
 
LVL 28

Expert Comment

by:sunnyc7
ID: 33516032
what version of exchange ?
0
 
LVL 28

Assisted Solution

by:sunnyc7
sunnyc7 earned 400 total points
ID: 33516049
Export-Mailbox -Identity john@contoso.com -EndDate "03/01/2010 12:01:00" -PSTFolderPath C:\PST\john.pst

All mails before 3/1/2010 will be copied to c:\pst\john.pst

0
 
LVL 1

Author Comment

by:Methodman85
ID: 33516259
Is the only way to do this to a PST? I think that will work, I can just export the PST into the achieve mailbox.

You see the user does not want a PST file, she wants another "user" mailbox, because she wants everything stored on the server and nowhere else.

It's Exchange 2007
0
Bringing Advanced Authentication to the SMB Market

WatchGuard announces the acquisition of advanced authentication provider, Datablink, with one mission – to bring secure authentication to SMB, mid-market, and distributed enterprises with a cloud-based solution, ideal for resale via their established channel & MSSP community.

 
LVL 28

Expert Comment

by:sunnyc7
ID: 33516279
You can create another mailbox - called >USERarchive

Import the pst into that and load it as additional mailbox.

that's better than PST I think.
0
 
LVL 1

Author Comment

by:Methodman85
ID: 33516505
Indeed, that's what I'll do. Now another question. Since this is exporting to a PST file, it will just be creating a copy. It won't actually be moving the files. The reason I need to do this is because the users mailbox is approaching 9GB, so is there a way to turn this into an archive process, so that the files are actually moved?
0
 
LVL 2

Accepted Solution

by:
dm_mcelduff earned 1600 total points
ID: 33518452
You actually do not need to export the mailbox to a PST file, you can just use the export-mailbox command to move direct to another mailbox.

offical guide: http://technet.microsoft.com/en-us/library/aa998579(EXCHG.80).aspx

an example of this would be to run the powershell command below:

export-Mailbox -Identity MailboxName -TargetMailbox ArchiveMailbox -EndDate <DateTime>

Then once you confirm the export is successful re-run the command with the additional switches below to clean up
export-Mailbox -Identity MailboxName -TargetMailbox ArchiveMailbox -EndDate <DateTime> -AllowMerge -DeleteContent

Note I haven't tested this so use with caution!

Note: The EndDate parameter specifies the end date for filtering content that will be moved from the source mailbox. Only items in the mailbox whose date is prior to or the same as the end date will be moved. When you enter a specific date, use the short date format that is defined in the Regional Options settings that are configured on the local computer. For example, if your computer is configured to use the short date format mm/dd/yyyy, enter 03/01/2006 to specify March 1, 2006.
0
 
LVL 1

Author Comment

by:Methodman85
ID: 33526431
It's asking me for TargetFolder parameter.
I want to keep the existing structure of the original mailbox. How can I do that?

[PS] C:\Documents and Settings\>export-Mailbox -Identity itsectest -TargetMailbox ARCTest -EndDate 8/22/2010

cmdlet Export-Mailbox at command pipeline position 1
Supply values for the following parameters:
TargetFolder:
0
 
LVL 1

Author Comment

by:Methodman85
ID: 33526449
If I say inbox it says.

StatusMessage                    : The target folder 'Inbox' is a special folder of target mailbox 'ARCTest', and is not supported by this command.
0
 
LVL 28

Expert Comment

by:sunnyc7
ID: 33526454
try mine
http:#33516049
0
 
LVL 1

Author Comment

by:Methodman85
ID: 33526774
I will, I will use that to do a full backup before I try the archive and delete options. I'm prepping an XP x86 VM to do this.
I should have this fully tested by tomorrow.
Thanks.
0
 
LVL 1

Author Closing Comment

by:Methodman85
ID: 33537380
Thanks!
I gave dm_mcelduff the main answer because this method saves me from having to manually go back to original mailbox and delete to old items.
0
 
LVL 28

Expert Comment

by:sunnyc7
ID: 33537409
Thanks for the points.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
This article describes how to import Lotus Notes Contacts into Outlook 2016, 2013, 2010 and 2007 etc. with a few manual steps. You can easily export and migrate Lotus Notes contacts into Microsoft Outlook without having to use any third party tools.
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Suggested Courses
Course of the Month8 days, 7 hours left to enroll

764 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