-
Notifications
You must be signed in to change notification settings - Fork 13
/
Get-MailboxMoveReport.ps1
47 lines (43 loc) · 1.49 KB
/
Get-MailboxMoveReport.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
function Get-MailboxMoveReport {
[CmdletBinding()]
param(
[Parameter(Position=0, Mandatory=$false)]
[String]
$Mailbox,
[Parameter(Position=1, Mandatory=$false)]
[String]
$Server = $env:COMPUTERNAME,
[Parameter(Position=2, Mandatory=$false)]
[String]
$Path = (Join-Path -Path $exinstall -ChildPath "Logging\MigrationLogs")
)
process {
$report = @()
$path = Join-Path "\\$server" $path.replace(":","$")
foreach ($item in gci $path *.xml) {
$report += [xml](Get-Content $item.fullname)
}
$report | %{
$MovedBy = $_."move-Mailbox".TaskHeader.RunningAs
$StartTime = $_."move-Mailbox".TaskHeader.StartTime
$EndTime = $_."move-Mailbox".TaskFooter.EndTime
$result = $_."move-mailbox".taskdetails.item | %{
New-Object PSObject -Property @{
Mailbox = $_.MailboxName
MovedBy = $MovedBy
MailboxSize = $_.MailboxSize
StartTime = $StartTime
EndTime = $EndTime
IsWarning = $_.result.IsWarning
ErrorCode = $_.result.ErrorCode
}
}
}
if($Mailbox) {
$result | ?{$_.Mailbox -eq (Get-Mailbox $Mailbox).DisplayName}
}
else {
$result
}
}
}