Solved

Exchange 2007 Export-Mailbox Help

Posted on 2013-06-18
4
307 Views
Last Modified: 2013-06-24
I need to run a export-mailbox weekly to move the mail from the inbox to an archive folder under the same email account. I would like to create a sub folder for each weekly archive to be the date of the archive run

Export-Mailbox -Identity journal -includefolder '\inbox'  -TargetMailbox journal -TargetFolder archive\date


I know I can add the -startdate $((get-date).adddays(-7))  -enddate $(get-date) to pull the data by the date

I would like to name the folders of archive by the name of the date.

example

Archive
       061013
       061713

Thanks
0
Comment
Question by:Thomas Grassi
  • 2
  • 2
4 Comments
 
LVL 18

Accepted Solution

by:
suriyaehnop earned 500 total points
ID: 39258449
try this

$today = Get-Date -Format "MMddyyyy"

$Folder = New-Item C:\Users\Archive -type Directory

$Mainfolder = 

$subfolder = New-Item $Folder '\' $today -type Directory

Export-Mailbox -Identity journal -includefolder '\inbox'  -TargetMailbox journal -TargetFolder $subfolder

Open in new window

0
 
LVL 23

Author Comment

by:Thomas Grassi
ID: 39261022
Thanks I  for the info

I just tested and it failed after I ran it a second time

could not create the directory because c:\users\archive already exsits

I was hoping to run this like outlook does for archiving  move all archive messages into an archive folder

Like

inboxc
    archive
         201301
         201302

etc

This is copying everything to the local hard drive I would like to keep it so I can look at the email based on month and year

Any ideas
0
 
LVL 23

Author Closing Comment

by:Thomas Grassi
ID: 39273304
lead me to possible solution but the script did not work as listed
0
 
LVL 18

Expert Comment

by:suriyaehnop
ID: 39273387
Could you share your script
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

Utilizing an array to gracefully append to a list of EmailAddresses
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this video we show how to create a Contact in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Recipients >> Contact ta…
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…

776 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