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
Solved

Need help with Powershell Script for Exchange

Posted on 2010-08-24
12
245 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
  • 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

856 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