locked
Exchange Back Up .pst Files RRS feed

  • Question

  • Hello,

     

    I am trying to back up all of our mailboxes using the Exchange Management Shell. I am very new to scripting so this is still a work in progress.

     

    New-Item E:\New Folder -type directory | Get-User | where { $_.Company -ilike "BGCAC*" } | Export-Mailbox -PSTFolderPath E:\PST -BadItemLimit 1000 -Confirm:$False -StartDate "05/14/2011 12:01:00"

     

    I realize that most of this text is for our company. My question is for the parts that are in bold. I have done back ups with this before but what I am look for is for the script to create new folders to throw the back ups into. I would like the folders to be created before the back up runs and for the folder to be given a unique name like the date it was performed.

    Any thoughts on how this can be done? Also, if you have any suggestions for me to add that can help please share.

    Tuesday, November 8, 2011 12:10 AM

Answers

  • You have to use a network share as a target, local paths are not supported.

    Check out the excellent blogpost from Steve Goodman: Using the Exchange 2010 SP1 Mailbox Export features for Mass Exports to PST files

    The script should help you along the way. I can already see that a variable is used for the target share. Shouldn't be too hard to get a current date into it with get-date orso.


    Technical Specialist / Infrastructure Architect @ www.OGD.nl - MCSE 2003 Messaging - MCITP Enterprise Messaging Administrator 2007 & 2010
    • Marked as answer by kgarrett34 Tuesday, November 8, 2011 5:39 PM
    • Unmarked as answer by kgarrett34 Wednesday, November 9, 2011 5:51 PM
    • Proposed as answer by Xiu Zhang Thursday, November 10, 2011 8:53 AM
    • Unproposed as answer by Xiu Zhang Monday, November 14, 2011 2:58 AM
    • Proposed as answer by Xiu Zhang Monday, November 14, 2011 2:58 AM
    • Marked as answer by Xiu Zhang Thursday, November 17, 2011 3:42 AM
    Tuesday, November 8, 2011 12:36 AM
  • You may also check:

    http://blogs.technet.com/b/sbs/archive/2011/05/09/how-to-import-and-export-mailboxes-using-pst-files-in-sbs-2011-standard.aspx

     

    If you are using BadItemLimit parameter with item count to 1000,you will have to use AcceptLargeDataLoss parameter as well and set it to true.

    • Marked as answer by kgarrett34 Tuesday, November 8, 2011 5:39 PM
    • Unmarked as answer by kgarrett34 Wednesday, November 9, 2011 5:51 PM
    • Proposed as answer by Xiu Zhang Thursday, November 10, 2011 8:53 AM
    • Marked as answer by Xiu Zhang Thursday, November 17, 2011 3:42 AM
    Tuesday, November 8, 2011 12:49 AM
  • Hi,

    You can try to start a scheduale task to run exchange script if it is the case that Tushar said.

    Exchange 2007 Script: how to run as a scheduled task?

    http://blogs.msdn.com/b/adamfazio/archive/2007/10/25/exchange-2007-script-how-to-run-as-a-scheduled-task.aspx

    Xiu

    • Proposed as answer by Xiu Zhang Monday, November 14, 2011 2:58 AM
    • Marked as answer by Xiu Zhang Thursday, November 17, 2011 3:42 AM
    Thursday, November 10, 2011 8:58 AM
  • I found it really hard  to run a scheduled task for an exchange management shell script. What I did was go through cmd as a .bat script. I think my problem was I was trying to run a .ps1 script from the task scheduler. I just added that into the cmd script.

     

    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto" ; c:\Windows\Scripts\Exchange-Backup-1.ps1 ; exit

     

    I couldn't figure out how to name the folders by the date they were ran so I just created four different scripts to run for the four weeks of the month. The reason I did that was because I could not figure out how to do incremental backups on the exchange management shell either. I know this is quite a mess and I'm sure there is something easier but this is what I have found so far.

    • Marked as answer by Xiu Zhang Thursday, November 17, 2011 3:42 AM
    Wednesday, November 16, 2011 6:42 PM

All replies

  • You have to use a network share as a target, local paths are not supported.

    Check out the excellent blogpost from Steve Goodman: Using the Exchange 2010 SP1 Mailbox Export features for Mass Exports to PST files

    The script should help you along the way. I can already see that a variable is used for the target share. Shouldn't be too hard to get a current date into it with get-date orso.


    Technical Specialist / Infrastructure Architect @ www.OGD.nl - MCSE 2003 Messaging - MCITP Enterprise Messaging Administrator 2007 & 2010
    • Marked as answer by kgarrett34 Tuesday, November 8, 2011 5:39 PM
    • Unmarked as answer by kgarrett34 Wednesday, November 9, 2011 5:51 PM
    • Proposed as answer by Xiu Zhang Thursday, November 10, 2011 8:53 AM
    • Unproposed as answer by Xiu Zhang Monday, November 14, 2011 2:58 AM
    • Proposed as answer by Xiu Zhang Monday, November 14, 2011 2:58 AM
    • Marked as answer by Xiu Zhang Thursday, November 17, 2011 3:42 AM
    Tuesday, November 8, 2011 12:36 AM
  • You may also check:

    http://blogs.technet.com/b/sbs/archive/2011/05/09/how-to-import-and-export-mailboxes-using-pst-files-in-sbs-2011-standard.aspx

     

    If you are using BadItemLimit parameter with item count to 1000,you will have to use AcceptLargeDataLoss parameter as well and set it to true.

    • Marked as answer by kgarrett34 Tuesday, November 8, 2011 5:39 PM
    • Unmarked as answer by kgarrett34 Wednesday, November 9, 2011 5:51 PM
    • Proposed as answer by Xiu Zhang Thursday, November 10, 2011 8:53 AM
    • Marked as answer by Xiu Zhang Thursday, November 17, 2011 3:42 AM
    Tuesday, November 8, 2011 12:49 AM
  • I guess I have one more question. How do you get the script to run on the Exchange Management Shell?
    Wednesday, November 9, 2011 5:51 PM
  • I didn get that....you just need to run it from EMS as given in the blog.....check the srennshots....or is there something specific you are looking for?
    Wednesday, November 9, 2011 6:33 PM
  • Are you asking about how to run the script as a scheduled task?

    Wednesday, November 9, 2011 7:43 PM
  • Hi,

    You can try to start a scheduale task to run exchange script if it is the case that Tushar said.

    Exchange 2007 Script: how to run as a scheduled task?

    http://blogs.msdn.com/b/adamfazio/archive/2007/10/25/exchange-2007-script-how-to-run-as-a-scheduled-task.aspx

    Xiu

    • Proposed as answer by Xiu Zhang Monday, November 14, 2011 2:58 AM
    • Marked as answer by Xiu Zhang Thursday, November 17, 2011 3:42 AM
    Thursday, November 10, 2011 8:58 AM
  • I found it really hard  to run a scheduled task for an exchange management shell script. What I did was go through cmd as a .bat script. I think my problem was I was trying to run a .ps1 script from the task scheduler. I just added that into the cmd script.

     

    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noexit -command ". 'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'; Connect-ExchangeServer -auto" ; c:\Windows\Scripts\Exchange-Backup-1.ps1 ; exit

     

    I couldn't figure out how to name the folders by the date they were ran so I just created four different scripts to run for the four weeks of the month. The reason I did that was because I could not figure out how to do incremental backups on the exchange management shell either. I know this is quite a mess and I'm sure there is something easier but this is what I have found so far.

    • Marked as answer by Xiu Zhang Thursday, November 17, 2011 3:42 AM
    Wednesday, November 16, 2011 6:42 PM