Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kevinblumenfeld/a07055e595305a514e4707904ef67e16 to your computer and use it in GitHub Desktop.
Save kevinblumenfeld/a07055e595305a514e4707904ef67e16 to your computer and use it in GitHub Desktop.
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