Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Fantasillion/3d45217e90ac80e9df733b3e15e68c36 to your computer and use it in GitHub Desktop.
Save Fantasillion/3d45217e90ac80e9df733b3e15e68c36 to your computer and use it in GitHub Desktop.
Office 365 Exchange Online Check for HiddenFromExchangeClientsEnabled
$Groups = Get-UnifiedGroup -ResultSize Unlimited | Select DisplayName, Alias, PrimarySmtpAddress, HiddenFromExchangeClientsEnabled
Write-Host "Processing" $Groups.Count "groups"
$Report = @()
$TeamsGroups = 0
$NoConvHistory = 0
ForEach ($G in $Groups) {
Write-Host "Processing" $G.DisplayName
If ($G.HiddenFromExchangeClientsEnabled -eq $true) { # Used to be HiddenFromExchangeClients
$ChatCheck = $Null
$ChatCheck = (Get-MailboxFolderStatistics -Identity $G.Alias -FolderScope ConversationHistory -IncludeOldestAndNewestItems)
If ($ChatCheck -eq $Null) { $NoConvHistory++ }
# Check that we have a Teams compliance folder and some items are present
ElseIf ($ChatCheck.FolderType[1] -eq "TeamChat" -and $ChatCheck.ItemsInFolder[1] -gt 0) {
$TeamsGroups++
Write-Host $G.DisplayName "has" $ChatCheck.ItemsInFolder[1] "compliance records - so it's active for Teams and hidden from Outlook"
$DateLastItem = $ChatCheck.NewestItemReceivedDate[1]
$ReportLine = [PSCustomObject][Ordered]@{
GroupName = $G.DisplayName
Alias = $G.Alias
Email = $G.PrimarySmtpAddress
Chats = $ChatCheck.ItemsInFolder[1]
LastAdded = $DateLastItem
Hidden = $G.HiddenFromExchangeClientsEnabled }
$Report += $ReportLine }
}
}
Write-Host $TeamsGroups "groups are used by Teams and could be unhidden from Exchange Clients"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment