Last active
June 22, 2020 18:42
-
-
Save bill-long/db11b0c962d89590b0c75eff1aa94785 to your computer and use it in GitHub Desktop.
This file contains 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 CheckFolderExists($folderToTest) { | |
$mbxs = Get-Mailbox -PublicFolder | |
Write-Output "Found $($mbxs.Count) public folder mailboxes" | |
$good = @() | |
$bad = @() | |
for ($i = 0; $i -lt $mbxs.Count; $i++) { | |
Write-Progress -Activity ($mbxs[$i].Identity) -PercentComplete ($i * 100 / $mbxs.Count) | |
$result = $null | |
$result = Get-PublicFolder $foldertoTest -Mailbox ($mbxs[$i].Identity) -ErrorAction SilentlyContinue | |
if ($null -ne $result) { | |
$good += $mbxs[$i].Identity.ToString() | |
} | |
else { | |
$bad += $mbxs[$i].Identity.ToString() | |
} | |
} | |
Write-Host "$($good.Count) mailboxes have it:" | |
$good | Sort | |
Write-Host "$($bad.Count) mailboxes don't have it." | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment