【问题标题】:Exchange 2010 Batch Export Mailboxes to .pst'sExchange 2010 将邮箱批量导出到 .pst
【发布时间】:2013-02-06 17:07:36
【问题描述】:

我有一个 Exchange 2010 环境,在 6 个数据库中拥有大约 1000 个用户。它们都启用了存储在不同数据库中的存档。

我有获取数据库的备份软件,但我想通过直接从 Exchange 导出邮箱的 .pst 来补充这一点。我想获取给定数据库中的所有用户并导出到 .pst。我的命令如下所示:

foreach ($i in (Get-Mailbox -database Accounting)) { New-MailboxExportRequest -Mailbox $i -FilePath "\\server\D$\PSTBackup\test\Accounting\$($i.Alias).pst" -baditemlimit 50 -acceptlargedataloss }

这样做的问题是它一次将它们全部导出(杀死我们的服务器资源),其中一半失败,因为一次运行太多。我想要一个脚本来一次备份大约 20 个邮箱。任何帮助表示赞赏。

【问题讨论】:

    标签: loops export exchange-server-2010 pst


    【解决方案1】:

    基本上你会想要创建一个新变量来保存结果 Get-Mailbox -database Accounting)

    然后,您可以使用该变量的计数百分比或特定数字以编程方式确定批次编号。

    $myEmailBoxes = Get-Mailbox -database Accounting

    $myEmailBoxes.count 应该告诉你列表中有多少个邮箱。不过,这可能不是 exchange powershell 的确切语法。在您进行测试时,您可能希望将结果Echo 输出到输出中,这样您就知道您得到了您期望的结果。

    要对事务进行批处理,请使用“for”循环而不是 for each 循环,并将其设置为您要批处理的数量。

    它看起来像下面这样:

    $allMailboxes = Get-Mailbox -database Adjunct
    $batchSize = 2
    $currentBatchIndex = 0
    $currentBatchMailboxes
    # Call the function to start the process
    batchMailboxes
    
    function batchMailboxes {
                    for (i = $currentBatchIndex; i < $currentBatchIndex + $batchSize; i++)
                    {
                                    $currentBatchMailboxes += $allMailboxes[i]
                                    $currentBatchIndex++
                    }
    
                    exportBatchedMailboxes($currentBatchMailboxes)
                    $batchStatus = getBatchedMailboxStatus($currentBatchMailboxes)
    
                    if ($batchStatus == false) {
                                    #Execute timer to get getBatchedMailboxStatus($currentBatchMailboxes)
                    }
                    else {
                                    if ($currentBatchIndex < $allMailboxes.count - 1) {
                                                    batchMailboxes
                                    }
                    }
    }
    
    function exportBatchedMailboxes ($exportMailboxes)
    {
                    foreach ($i in $exportMailboxes) {
                                    New-MailboxExportRequest -Mailbox $i -FilePath "backuplocation\Adjunct\$($i.Alias).pst" -baditemlimit 50 -acceptlargedataloss
                    }
    }
    
    function getBatchedMailboxStatus ($batch)
    {
                    # command for checking status needs to go here using a foreach loop
    }
    

    这是完美运行的脚本的完整实现http://blog.bluepegasusinc.com/index.php/batch-export-exchange-2010-mailbox-to-pst/

    【讨论】:

    • 以上将允许您检查当前批处理邮箱的状态,然后再继续处理其他邮箱。如果它们失败了,那没关系,因为您不想因此而停止整个备份。它可以让您减轻服务器负载并确保它不会不堪重负
    猜你喜欢
    • 2012-11-27
    • 2018-03-23
    • 1970-01-01
    • 1970-01-01
    • 2012-01-11
    • 2013-12-17
    • 2014-12-07
    • 1970-01-01
    • 2022-12-07
    相关资源
    最近更新 更多