我可以将邮箱导出到Exchange Server 2010 SP3上的PST导出队列吗?

时间:2017-10-11 12:20:16

标签: powershell exchange-server exchange-server-2010

我处于这种情况,当我想将几个邮箱排队导出(我不希望它们同时处理)到PST文件。我知道,如何使用命令get-mailboxexportrequest将它们导出,但是当我这样做时,它们几乎立即开始。我可以以某种方式排队另一个邮箱,所以当前一个邮箱完成时它会自动启动吗?

1 个答案:

答案 0 :(得分:0)

我会做以下事情:

  • 构建一个powershell脚本,检查是否存在正在运行的导出(通过Get-MailboxExportRequest),如果不是这种情况开始导出您在CSV文件中指定的x个邮件文件
  • 使用Exchange Server上的Windows任务管理器触发该脚本,并在此处定义时间范围,以及脚本运行的频率和时间
  • PowerShell脚本运行后,应从CSV文件中删除导出的邮件文件,然后退出
  • 从powershell脚本通过taskmanager的下一次运行将检查当前作业是否仍在进行,如果是,它应该退出,直到从列表中取出下一个条目为止

更新

作为一个起点,类似下面的内容应该没问题(未经测试,但应该给你一个起点):

# Get current Export Requests
$ExportStats = Get-MailboxExportRequest

#Check if there are completed questes
If ($ExportStats.Status -eq "Completed")
{
  Write-Host "Export done"
  Get-MailboxExportRequest -Status Completed -Name "$ObjectName-Export" | Remove-MailboxExportRequest -Confirm:$false
  #Disable-Mailbox -identity "AD\$ObjectName"

  # Create a new CSV file, which isn´t including the current export name we just marked as finish via above's section.      
  # CODE MISSING HERE!      

  # Now import our CSV list and proceed it
  Import-CSV <Filepath of CSV file(\\server\folder\file.csv)> | ForEach-Object {
  # Perform the export
  New-MailboxExportRequest -Mailbox $_.MailboxAlias -FilePath $_.PSTpath
  New-MailboxExportRequest -Mailbox $_.MailboxAlias -FilePath $_.ArchivePath
  # Once done exit here, this will ensure we proceed only the first entry
  Exit
  } 

}
elseif ($ExportStats.Status -eq "InProgress")
{
    Write-Host "Export still ongoing"    
}
相关问题