[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 353
  • Last Modified:

Exchange 2007 Export-Mailbox Help

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
Thomas Grassi
Asked:
Thomas Grassi
  • 2
  • 2
1 Solution
 
suriyaehnopCommented:
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
 
Thomas GrassiSystems AdministratorAuthor Commented:
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
 
Thomas GrassiSystems AdministratorAuthor Commented:
lead me to possible solution but the script did not work as listed
0
 
suriyaehnopCommented:
Could you share your script
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now