Hide Office 365 Group from GAL using PowerShell

Requirement: Hide Office 365 Group from GAL (Global Address List).

How to Hide a Microsoft 365 Group from GAL?

By default, when you create an Office 365 group, it is visible in the Global Address List (GAL). You can hide any Office 365 group from GAL by setting its property “Don’t show team email address in Outlook” from the Microsoft 365 Admin Center. Here is how:

  1. Open the Office 365 Admin Center and go to the Groups section.
  2. Click on the group that you want to hide from the GAL.
  3. In the group settings, click on the “Don’t show Team email address in Outlook” check box.
    hide office 365 group from gal
  4. Click on “Save” to save the changes.

This will make the Office 365 group private, and it will no longer be visible in the GAL. BTW, You can also set the group privacy to “Private” so that it is visible only to the group members!

Remove a Group from GAL using the Exchange Admin Center

To hide a group from the Global Address List (GAL) in Office 365 using the Exchange Admin Center, you can follow these steps:

  1. Go to the Exchange Admin Center in Office 365.
  2. Click on “Recipients” in the left-hand navigation pane, and then click on “Groups.”
  3. Select the group that you want to hide from the GAL.
  4. In the group properties, under “Settings,” select “Hide this group from the global address list.” and click on Save button.
    hide group from global address list microsoft 365

Please note that it may take some time for the changes to be reflected in the GAL.

How to Hide Office 365 Group from GAL using PowerShell?

If you don’t wish your Office 365 group appears in the global address list, you can hide it using the Set-UnifiedGroup cmdlet. Here is how to hide the group from the address list:

#Get Credentials to connect
$Credential = Get-Credential

#Connect to Exchange Online
Connect-ExchangeOnline -Credential $Credential -ShowBanner:$False

#hide office 365 group from gal using powershell
Set-UnifiedGroup -Identity "Vendors@TheCrescentTech.com" -HiddenFromAddressListsEnabled $True

#Disconnect Exchange Online
Disconnect-ExchangeOnline -Confirm:$False

This PowerShell hides Office 365 Group from GAL. Similarly, You can hide Office 365 group from Exchange clients using the:

Set-UnifiedGroup -Identity "Vendors@TheCrescentTech.com" -HiddenFromExchangeClientsEnabled:$True
hide office 365 group from gal using powershell

This hides the group from the Groups section in Exchange clients like OWA.

Hide All Microsoft Team’s Groups from Outlook

Let’s hide all groups created as part of Microsoft Teams:

#Connect to Exchange Online
Connect-ExchangeOnline -ShowBanner:$False

#Get All Microsoft 365 Groups created as part of Teams
$TeamsGroups = Get-UnifiedGroup -Filter {ResourceProvisioningOptions -eq "Team"} -ResultSize Unlimited

#Hide the gropus from GAL
ForEach ($Group in $TeamsGroups)
{
    If($Group.HiddenFromAddressListsEnabled -eq $False)
    {
        Set-UnifiedGroup -Identity $Group.ExternalDirectoryObjectId -HiddenFromExchangeClientsEnabled:$True -HiddenFromAddressListsEnabled:$True
        Write-Host "Group Set to Hidden from GAL:" $Group.DisplayName -f Green
    }
}

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

2 thoughts on “Hide Office 365 Group from GAL using PowerShell

  • # Get Microsoft 365 Groups created as part of Teams with section prefix

    # Doing the “if not hidden” check directly in the filter is better.
    $TeamsGroups = Get-UnifiedGroup -Filter {ResourceProvisioningOptions -eq “Team” -and PrimarySmtpAddress -like ‘Section*’ -and HiddenFromAddressListsEnabled -eq $false } -ResultSize 2000

    # Hide the group from GAL
    ForEach ($Group in $TeamsGroups)
    {
    Set-UnifiedGroup -Identity $Group.ExternalDirectoryObjectId -HiddenFromExchangeClientsEnabled:$True -HiddenFromAddressListsEnabled:$True
    Write-Host “Group Set to Hidden from GAL:” $Group.DisplayName -f Green
    }

    Reply
  • Is there a way to apply it to all groups?

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *