[玩转系统] 使用 PowerShell 查看和导出有关邮箱迁移到 Office 365 的信息 |第 3 部分#5
作者:精品下载站 日期:2024-12-14 09:06:50 浏览:16 分类:玩电脑
使用 PowerShell 查看和导出有关邮箱迁移到 Office 365 的信息 |第 3 部分#5
在当前文章和下一篇文章中,我们将回顾可用于查看和导出有关 Exchange 邮箱迁移过程的信息的各种 PowerShell cmdlet。
我们在本文中回顾的“邮箱迁移”PowerShell 命令是:
- 获取迁移批处理
- 获取移动请求
- Get-MoveRequestStatistics
1、迁移批次|获取迁移批处理
术语“迁移批次”定义充当“逻辑容器”的实体,其中包含我们从源 Exchange 服务器迁移到目标 Exchange 的邮箱(及其关联用户)服务器(在我们的场景中为 Exchange Online)。
获取有关特定迁移批次的信息
PowerShell命令语法:
Get-MigrationBatch -Identity <Migration BATCH name>
PowerShell 控制台输出示例:
PS C:\> Get-MigrationBatch "Eyal Migration batch -001" |fl
RunspaceId : 2771b392-d73b-4639-b63d-f4646c49c0af
Identity : Eyal Migration batch -001
Status : Completed
State : Completed
Flags : None
WorkflowStage : Processing
TriggeredAction : None
BatchGuid : fb2529fe-b9bf-446a-accd-3819e6bef03c
TotalCount : 2
ActiveCount : 0
StoppedCount : 0
SyncedCount : 0
FinalizedCount : 2
FailedCount : 0
FailedInitialSyncCount : 0
FailedIncrementalSyncCount : 0
CompletedWithWarningCount : 0
PendingCount : 0
ProvisionedCount : 0
ValidationWarningCount : 0
ValidationWarnings : {}
Message :
CreationDateTime : 2/23/2017 10:41:09 AM
CreationDateTimeUTC : 2/23/2017 8:41:09 AM
StartDateTime : 2/23/2017 10:41:09 AM
StartDateTimeUTC : 2/23/2017 8:41:09 AM
InitialSyncDateTime :
InitialSyncDateTimeUTC :
InitialSyncDuration :
LastSyncedDateTime : 2/23/2017 10:47:28 AM
LastSyncedDateTimeUTC : 2/23/2017 8:47:28 AM
FinalizedDateTime :
FinalizedDateTimeUTC :
SubmittedByUser : [email protected]
OwnerId : EURPR05A001.prod.outlook.com/Microsoft Exchange Hosted Organizations/o365info2.onmicrosoft.com/Eyal
OwnerExchangeObjectId : 7646f17d-bf1f-4e07-8698-4e71ab4dad80
NotificationEmails : {[email protected]}
ExcludedFolders : {}
MigrationType : ExchangeRemoteMove
BatchDirection : Onboarding
Locale : en-US
Reports : {When migration report was created:2/23/2017 9:19:17 AM; Migration report URL:https://outlook.office365.com/ecp/Migration/DownloadReport.aspx?HandlerClass=
MigrationReportHandler&Name=MigrationReport.csv&DelegatedOrg=o365info2.onmicrosoft.com&realm=o365info2.onmicrosoft.com&exsvurl=1&Identity=RgAAAAAKqOiME1CMQ
LkjirbMEluxBwCuLv0wEUQXTp3grhMeQsz8AAAh0Mi_AACuLv0wEUQXTp3grhMeQsz8AAN-JngxAAAJ; Error report URL:}
IsProvisioning : False
BatchFlags : ReportInitial
WorkflowControlFlags : None
AutoRetryCount : 0
CurrentRetryCount : 0
AllowUnknownColumnsInCsv : False
DiagnosticInfo :
SupportedActions : Remove
SourceEndpoint : mail.o365info.com
TargetEndpoint :
SourcePublicFolderDatabase :
TargetDatabases : {}
TargetArchiveDatabases : {}
TargetDAGs : {}
BadItemLimit : 10
LargeItemLimit : 0
MoveOptions : {}
SkipMoving : {}
SkipMerging : {}
InternalFlags : {}
PrimaryOnly : False
ArchiveOnly : False
TargetDeliveryDomain : o365info2.mail.onmicrosoft.com
SkipSteps : None
Workflow : Steps: [(Injection), (Processing)]
WorkflowTemplate :
Report :
StartAfter :
StartAfterUTC :
CompleteAfter :
CompleteAfterUTC :
IsValid : True
ObjectState : Unchanged
导出有关特定迁移批次的详细信息 | TXT文件
Get-MigrationBatch -Identity migration-003 -IncludeReport -Diagnostic | Format-List | Out-File c:\temp\"Get-MigrationBatch-IncludeReport-Diagnostic.txt" -Encoding UTF8
导出有关所有迁移批次的详细信息
导出信息到TXT文件
Get-MigrationBatch -IncludeReport -Diagnostic | Format-List | Out-File c:\temp\"ALL Migration -Get-MigrationBatch-IncludeReport-Diagnostic.txt" -Encoding UTF8
将信息导出到 XML 文件
Get-MigrationBatch -IncludeReport -Diagnostic | Export-Clixml
c:\temp\"ALL Migration Get-MigrationBatch-IncludeReport-Diagnostic.xml" -Encoding UTF8
迁移批次状态
使用“Status”参数,我们可以获得有关具有特定“Status”的现有迁移批次的信息。
“Statuses”值的迁移批次类型可以如下:
- 完全的
- 已完成但有错误
- 正在完成
- 已损坏
- 已创建
- 失败的
- 增量同步
- 去除
- 开始
- 已停止
- 正在同步
- 停止
- 已同步
- 与错误同步
- 等待
要查看具有特定状态的迁移批次,我们可以使用以下 PowerShell 语法。
显示状态为“已完成”的所有迁移批次
PowerShell 命令示例:
Get-MigrationBatch -Status Completed
PowerShell 控制台输出示例:
PS C:\> Get-MigrationBatch -Status Completed
Identity Status Type TotalCount
-------- ------ ---- ----------
Eyal Migration batch -001 Completed ExchangeRemoteMove 2
Eyal Migration batch -002 Completed ExchangeRemoteMove 2
导出状态为“未完成”的所有迁移批次的信息 | TXT文件
PowerShell 命令示例:
Get-MigrationBatch | Where {$_.status -ne ”Completed”} | Get-MoveRequestStatistics | Format-List | Out-File c:\temp\"Get-MigrationBatch Not Completed.txt" -Encoding UTF8
3. 移动请求
术语“移动请求”定义了我们从“源 Exchange 服务器”迁移到“目标 Exchange 服务器”的 Exchange 邮箱。
我们用于获取有关“邮箱实体”的移动请求信息的两个 PowerShell cmdlet 是:
- 获取移动请求
- 获取移动请求统计
2. 使用 Get-MoveRequest 命令
PowerShell 命令Get-MoveRequest,获取有关我们迁移的特定邮箱的属性的基本信息。
获取有关特定移动请求的信息
PowerShell 命令语法
Get-MoveRequest < Move Request name>
PowerShell 控制台输出示例
PS C:\> Get-MoveRequest [email protected] | Format-List
RunspaceId : 2771b392-d73b-4639-b63d-f4646c49c0af
ExchangeGuid : e3254cfe-81c0-496e-84db-80e9190342e5
SourceDatabase :
TargetDatabase : EURPR05DG136-db018
SourceArchiveDatabase :
TargetArchiveDatabase :
Flags : CrossOrg, Pull
RemoteHostName : mail.o365info.com
BatchName : MigrationService:Eyal Migration batch -001
Status : Completed
RequestStyle : CrossOrg
Direction : Pull
IsOffline : False
Protect : False
Suspend : False
SuspendWhenReadyToComplete : False
AdministrativeUnits : {}
Alias : onpremmbx-01
ExtensionCustomAttribute1 : {}
ExtensionCustomAttribute2 : {}
ExtensionCustomAttribute3 : {}
ExtensionCustomAttribute4 : {}
ExtensionCustomAttribute5 : {}
DisplayName : onpremmbx-01
ExternalDirectoryObjectId : c4d8af0e-69f2-4534-b79c-04ddaea7d074
LastExchangeChangedTime :
RecipientType : UserMailbox
RecipientTypeDetails : UserMailbox
Identity : onpremmbx-01
IsValid : True
ExchangeVersion : 0.20 (15.0.0.0)
Name : onpremmbx-01
DistinguishedName : CN=onpremmbx-01,OU=o365info2.onmicrosoft.com,OU=Microsoft Exchange Hosted Organizations,DC=EURPR05A001,DC=prod,DC=outlook,DC=com
Guid : 1e697c91-3a05-490d-a1d2-4434471cd1d9
OrganizationId : EURPR05A001.prod.outlook.com/Microsoft Exchange Hosted Organizations/o365info2.onmicrosoft.com - EURPR05A001.prod.outlook.com/ConfigurationUnits/o365info2.onmicrosoft.com/Configuration
Id : onpremmbx-01
OriginatingServer : DB3PR05A001DC03.EURPR05A001.prod.outlook.com
ObjectState : Changed
导出有关特定移动请求的信息 | TXT文件
Get-MoveRequest [email protected] | Format-List | Out-File c:\temp\"Get-MoveRequest.txt" -Encoding UTF8
获取有关所有现有移动邮箱请求的信息
当我们使用 PowerShell 时,命令 Get-MoveRequest 与特定移动请求无关,这意味着,在不指定特定移动请求身份的情况下,PowerShell 命令将显示有关所有现有“移动请求”的信息。
注意:如果您执行的邮箱迁移包括数十个或数百个邮箱,则导出有关每个已迁移邮箱的信息的过程可能需要很长时间。
导出有关所有移动请求的信息 | TXT文件
PowerShell 命令示例
Get-MoveRequest | Format-List | Out-File c:\temp\"Get-MoveRequest.txt" -Encoding UTF8
导出有关具有特定状态的 MoveRequest 的信息
每个“移动请求”都可以有一个特定的“状态”,例如已完成、失败等。
可用的状态代码值如下:
- 自动暂停
- 完全的
- 已完成但有警告
- 完成中
- 失败的
- 进行中
- 没有任何
- 排队
如果您只想获取有关“移动请求”特定状态的信息,可以使用以下 PowerShell 语法。
导出有关状态未“已完成”的所有移动请求的信息 | TXT文件
Get-MoveRequest | Where {$_.status -ne ”Completed”} | Get-MoveRequestStatistics | Format-List | Out-File c:\temp\"Get-MoveRequest- status is not completed.txt" -Encoding UTF8
导出有关状态为“失败”的所有移动请求的信息 | TXT文件
PowerShell 命令示例:
Get-MoveRequest | Where {$_.status -eq ”Failed”} | Get-MoveRequestStatistics | Format-List | Out-File c:\temp\"Get-MoveRequest- status is Failed.txt" -Encoding UTF8
3. 使用 MoveRequestStatistics 命令
PowerShell 命令 Get-MoveRequestStatistics 的目的是获取有关“迁移的邮箱内容”的详细信息。
例如:
- ItemsTransferred:有关已传输的邮件数量的信息。
- 完成百分比:顾名思义,有关邮箱迁移过程的“完成百分比”的信息。
获取移动请求 特定移动请求的统计信息
PowerShell 命令语法
Get-MoveRequestStatistics <Migrated mailbox>
PowerShell 控制台输出示例
PS C:\> Get-MoveRequestStatistics [email protected]
DisplayName StatusDetail TotalMailboxSize TotalArchiveSize PercentComplete
----------- ------------ ---------------- ---------------- ---------------
onpremmbx-01 Completed 7.148 MB (7,495,583 bytes) 100
导出有关特定移动请求的信息TXT文件
Get-MoveRequestStatistics [email protected] | Format-List | Out-File c:\temp\"Get-MoveRequestStatistics.txt" -Encoding UTF8
如果我们想消除不必要的数据并获得邮箱迁移统计信息的“清晰视图”,我们可以要求PowerShell仅显示特定的数据字段。
PowerShell 命令示例:
Get-MoveRequestStatistics [email protected] | Select MailboxIdentity,Status,WorkloadType,RecipientTypeDetails,SourceServer ,BatchName,TotalMailboxSize,TotalMailboxItemCount,TotalArchiveSize,BytesTransferred,BytesTransferredPerMinute,ItemsTransferred,PercentComplete | Format-List | Out-File c:\temp\"Get-MoveRequestStatistics.txt" -Encoding UTF8
组合 Get-MoveRequest + Get-Moverequeststatistics 命令
使用 PowerShell 时我们可以使用的一个不错的选项是两个或多个 PowerShell 命令的“组合”。此方法的正式术语是“管道”。
在以下场景中,我们组合使用两个 PowerShell 命令:
- 获取移动请求
- Get-MoveRequestStatistics
第一个命令Get-MoveRequest将“获取”所有现有的“移动请求”。
第二个命令Get-MoveRequestStatistics,将使用第一个命令中的“移动请求列表”,并为每个邮箱移动请求添加“统计信息”。
组合 Get-MoveRequest + Get-Moverequeststatistics 命令
PowerShell命令语法:
Get-MoveRequest| Get-Moverequeststatistics
PowerShell 控制台输出示例:
PS C:\> Get-MoveRequest| Get-Moverequeststatistics
DisplayName StatusDetail TotalMailboxSize TotalArchiveSize PercentComplete
----------- ------------ ---------------- ---------------- ---------------
onpremmbx-02 Completed 7.148 MB (7,495,429 bytes) 100
onpremmbx-03 Completed 7.148 MB (7,495,563 bytes) 100
onpremmbx-04 Completed 7.148 MB (7,495,449 bytes) 100
onpremmbx-01 Completed 7.148 MB (7,495,583 bytes) 100
获取+导出有关所有并发移动请求的信息统计+故障排除信息
在此场景中,我们添加附加参数 -IncludeReport 和 -Diagnostic 以获取有关移动请求统计信息的更多详细信息。大多数时候,我们会在故障排除场景中使用这个附加参数。
另外,我添加了一个将信息导出到 XML 文件的示例,因为如果我们需要将导出的信息传递给 Microsoft 支持人员进行进一步分析,这是“首选”文件格式。
组合 Get-MoveRequest + Get-Moverequeststatistics 命令
导出信息到TXT文件
Get-MoveRequest| Get-Moverequeststatistics -IncludeReport -Diagnostic | Format-List | Out-File c:\temp\"Get-Move-Request-Get-Moverequeststatistics.txt" -Encoding UTF8
将信息导出到 CSV 文件
Get-MoveRequest| Get-Moverequeststatistics -IncludeReport -Diagnostic | Export-CSV c:\temp\"Get-Move-Request-Get-Moverequeststatistics.CSV" -NoTypeInformation -Encoding utf8
将信息导出到 XML 文件
Get-MoveRequest| Get-Moverequeststatistics -IncludeReport -Diagnostic | Export-Clixml
c:\temp\"Get-MoveRequestStatistics-IncludeReport-Diagnostic.xml" -Encoding UTF8
我们可以使用 PowerShell 命令语法的其他变体来获取有关具有特定状态的移动请求的信息,例如失败的移动请求+有关每个移动请求的统计信息。
PowerShell 命令示例:
Get-MoveRequest -movestatus Failed| Get-moverequeststatistics |select DisplayName,SyncStage,Failure*,Message,PercentComplete,largeitemsencountered,baditemsencountered| ft -autosize
下载邮件迁移 PowerShell 脚本
当前文章系列的下一篇文章
使用 PowerShell 查看和导出有关邮箱迁移到 Office 365 的信息 |第 4 部分#5
猜你还喜欢
- 03-30 [玩转系统] 如何用批处理实现关机,注销,重启和锁定计算机
- 02-14 [系统故障] Win10下报错:该文件没有与之关联的应用来执行该操作
- 01-07 [系统问题] Win10--解决锁屏后会断网的问题
- 01-02 [系统技巧] Windows系统如何关闭防火墙保姆式教程,超详细
- 12-15 [玩转系统] 如何在 Windows 10 和 11 上允许多个 RDP 会话
- 12-15 [玩转系统] 查找 Exchange/Microsoft 365 中不活动(未使用)的通讯组列表
- 12-15 [玩转系统] 如何在 Windows 上安装远程服务器管理工具 (RSAT)
- 12-15 [玩转系统] 如何在 Windows 上重置组策略设置
- 12-15 [玩转系统] 如何获取计算机上的本地管理员列表?
- 12-15 [玩转系统] 在 Visual Studio Code 中连接到 MS SQL Server 数据库
- 12-15 [玩转系统] 如何降级 Windows Server 版本或许可证
- 12-15 [玩转系统] 如何允许非管理员用户在 Windows 中启动/停止服务
取消回复欢迎 你 发表评论:
- 精品推荐!
-
- 最新文章
- 热门文章
- 热评文章
[影视] 黑道中人 Alto Knights(2025)剧情 犯罪 历史 电影
[古装剧] [七侠五义][全75集][WEB-MP4/76G][国语无字][1080P][焦恩俊经典]
[实用软件] 虚拟手机号 电话 验证码 注册
[电视剧] 安眠书店/你 第五季 You Season 5 (2025) 【全10集】
[电视剧] 棋士(2025) 4K 1080P【全22集】悬疑 犯罪 王宝强 陈明昊
[软件合集] 25年6月5日 精选软件22个
[软件合集] 25年6月4日 精选软件36个
[短剧] 2025年06月04日 精选+付费短剧推荐33部
[短剧] 2025年06月03日 精选+付费短剧推荐25部
[软件合集] 25年6月3日 精选软件44个
[剧集] [央视][笑傲江湖][2001][DVD-RMVB][高清][40集全]李亚鹏、许晴、苗乙乙
[电视剧] 欢乐颂.5部全 (2016-2024)
[电视剧] [突围] [45集全] [WEB-MP4/每集1.5GB] [国语/内嵌中文字幕] [4K-2160P] [无水印]
[影视] 【稀有资源】香港老片 艺坛照妖镜之96应召名册 (1996)
[剧集] 神经风云(2023)(完结).4K
[剧集] [BT] [TVB] [黑夜彩虹(2003)] [全21集] [粤语中字] [TV-RMVB]
[实用软件] 虚拟手机号 电话 验证码 注册
[资源] B站充电视频合集,包含多位重量级up主,全是大佬真金白银买来的~【99GB】
[影视] 内地绝版高清录像带 [mpg]
[书籍] 古今奇书禁书三教九流资料大合集 猎奇必备珍藏资源PDF版 1.14G
[电视剧] [突围] [45集全] [WEB-MP4/每集1.5GB] [国语/内嵌中文字幕] [4K-2160P] [无水印]
[剧集] [央视][笑傲江湖][2001][DVD-RMVB][高清][40集全]李亚鹏、许晴、苗乙乙
[电影] 美国队长4 4K原盘REMUX 杜比视界 内封简繁英双语字幕 49G
[电影] 死神来了(1-6)大合集!
[软件合集] 25年05月13日 精选软件16个
[精品软件] 25年05月15日 精选软件18个
[绝版资源] 南与北 第1-2季 合集 North and South (1985) /美国/豆瓣: 8.8[1080P][中文字幕]
[软件] 25年05月14日 精选软件57个
[短剧] 2025年05月14日 精选+付费短剧推荐39部
[短剧] 2025年05月15日 精选+付费短剧推荐36部
- 最新评论
-
- 热门tag