Created
June 3, 2017 00:23
-
-
Save kevinblumenfeld/a07055e595305a514e4707904ef67e16 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-LAcolTest { | |
[CmdletBinding()] | |
Param | |
( | |
) | |
Begin { | |
} | |
Process { | |
$mailbox = Get-Mailbox -IncludeInactiveMailbox -ResultSize 600 | Select displayname, userprincipalname, inplaceholds, IsInactiveMailbox, accountdisabled, RecipientTypeDetails | |
$HoldList = Get-MailboxSearch | Select Name, InPlaceHoldIdentity | |
$hash = @{} | |
foreach ($Hold in $HoldList) { | |
$hash.add($hold.InPlaceHoldIdentity, $hold.name) | |
} | |
foreach ($row in $mailbox) { | |
if ($row.inplaceholds) { | |
$i = 0 | |
ForEach ($hold in $row.inplaceholds.split()) { | |
$i++ | |
Write-Host "I: " $i $hold | |
$row | Add-Member -MemberType NoteProperty -Name "LAHold$i" -Value $($hash[$hold]) | |
} $row | |
} | |
} | |
} | |
End { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment