我处于这种情况,当我想将几个邮箱排队导出(我不希望它们同时处理)到PST文件。我知道,如何使用命令get-mailboxexportrequest将它们导出,但是当我这样做时,它们几乎立即开始。我可以以某种方式排队另一个邮箱,所以当前一个邮箱完成时它会自动启动吗?
答案 0 :(得分:0)
我会做以下事情:
更新
作为一个起点,类似下面的内容应该没问题(未经测试,但应该给你一个起点):
# 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"
}