Exchange Mailbox backups for previous month

Welcome Forums General PowerShell Q&A Exchange Mailbox backups for previous month

This topic contains 1 reply, has 2 voices, and was last updated by

3 years, 3 months ago.

  • Author
  • #32829

    Points: 0
    Rank: Member

    Hi I am trying to write new script which is supposed to take backup of all mailboxes to shared location for previous month. Say If I run the script on Dec. 10' 2015 then it will export all mailboxes from Nov. 10 to Dec. 10 2015 and in future if I run script on Dec 24' 2015 it have to export mailboxes from Nov. 24 to Dec. 24' 2015. Here's the script which I am trying.

    $Export = Get-Mailbox
    $endDate = $endDate.AddMonths(-1)
    $month = "{0:D2}" -f [int]$startDate.Month
    $endDate = $endDate.ToShortDateString()
    $startDate = $startDate.ToShortDateString()
    New-MailboxExportRequest -ContentFilter {(Received -ge $startDate) -and (Received -lt $endDate)} -Mailbox $Export -FilePath "\\FileServer\EmailBackups\ExportTest\MonthTest\$($_.alias).pst"
    Write-Host "Done".
  • #32903

    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    That looks great. However, you haven't mentioned if you're having a problem or need a question answered.

The topic ‘Exchange Mailbox backups for previous month’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort