Solved

Need help with Powershell Script for Exchange

Posted on 2010-08-24
12
246 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 100 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 400 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

762 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