locked
Daily Export of a User's Mailbox to PST RRS feed

  • Question

  • I need to create a daily export of a user's mailbox to a PST. Does anyone know a Powershell command that would export this person's mailbox to a folder and include the date somehow?

    Kind regards,

    Richard Long

    Monday, August 29, 2016 5:41 PM

Answers

  • New-MailboxExportRequest -ContentFilter {(Received -gt '<day of export>') -and (Received -lt 'day after export')} -Mailbox <mailbox alias> -Name <Export Name> -FilePath <file path on accessible file share>

    So for exporting Tom Johnson's mailbox for April 15, 2016 to a PST on \\FileServer\MailboxExports, you'd run:

    New-MailboxExportRequest -ContentFilter {(Received -gt '4/15/2016') -and (Received -lt '4/16/2016')} -Mailbox TJohnson -Name TJohnson-04-15-2016 -FilePath \\FileServer\MailboxExports\TJohnson-04-15-2016.pst

    And if you want to use variables for date and user name, you'd use:

    $Mailbox = TJohnson
    $DateOf = Get-Date 4/15/2016
    $DateAfter = $DateOf.AddDays(1)
    $FileName = "$Mailbox-$(($DateOf.GetDateTimeFormats() | ? { $_ -match '2016-' })[0])"
    New-MailboxExportRequest -ContentFilter {(Received -gt $DateOf) -and (Received -lt $DateAfter)} -Mailbox $Mailbox -Name "$FileName" -FilePath "\\FileServer\MailboxExports\$FileName.pst"


    Will Martin ...
    -join ('77696c6c406d617274696e2d66616d696c6965732e6f7267' -split '(?<=\G.{2})' | ? { $_ } | % { [char][int]"0x$_" })

    Monday, August 29, 2016 6:56 PM

All replies

  • The answer is yes.  Someone knows.  But we're not mind readers, so what version, service pack, update rollup and/or cumulative update of Exchange Server are you running?


    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
    Celebrating 20 years of providing Exchange peer support!

    Monday, August 29, 2016 6:15 PM
  • Those are just minor details.  :)  Thank you. I'm running Exchange 2010 SP3 with RU14
    Monday, August 29, 2016 6:30 PM
  • New-MailboxExportRequest -ContentFilter {(Received -gt '<day of export>') -and (Received -lt 'day after export')} -Mailbox <mailbox alias> -Name <Export Name> -FilePath <file path on accessible file share>

    So for exporting Tom Johnson's mailbox for April 15, 2016 to a PST on \\FileServer\MailboxExports, you'd run:

    New-MailboxExportRequest -ContentFilter {(Received -gt '4/15/2016') -and (Received -lt '4/16/2016')} -Mailbox TJohnson -Name TJohnson-04-15-2016 -FilePath \\FileServer\MailboxExports\TJohnson-04-15-2016.pst

    And if you want to use variables for date and user name, you'd use:

    $Mailbox = TJohnson
    $DateOf = Get-Date 4/15/2016
    $DateAfter = $DateOf.AddDays(1)
    $FileName = "$Mailbox-$(($DateOf.GetDateTimeFormats() | ? { $_ -match '2016-' })[0])"
    New-MailboxExportRequest -ContentFilter {(Received -gt $DateOf) -and (Received -lt $DateAfter)} -Mailbox $Mailbox -Name "$FileName" -FilePath "\\FileServer\MailboxExports\$FileName.pst"


    Will Martin ...
    -join ('77696c6c406d617274696e2d66616d696c6965732e6f7267' -split '(?<=\G.{2})' | ? { $_ } | % { [char][int]"0x$_" })

    Monday, August 29, 2016 6:56 PM
  • Perfect!  Thank you very much!
    Monday, August 29, 2016 7:26 PM
  • Vendor shill post above.

    Ed Crowley MVP "There are seldom good technological solutions to behavioral problems."
    Celebrating 20 years of providing Exchange peer support!

    Tuesday, August 30, 2016 3:53 PM