Share via


Hide Microsoft 365 Groups from the GAL and Exchange Clients

Schools may require that newly created classes are hidden from the Global Address List (GAL) in Exchange Online or from Exchange clients such as Outlook or the Outlook Web App. Classes may be hidden through PowerShell. Use the instructions below to hide Classes created with SDS from the GAL and Exchange Clients.

Classes are represented in Office 365 as Groups. In Exchange Online, where the GAL is built and the groups email address are located, they're called Unified Groups. Use the Get/Set-UnifiedGroup cmdlet to manage these groups through PowerShell.

Note

For more information about the cmdlet, see Set-UnifiedGroup.

Connect to Exchange Online PowerShell

Open Windows PowerShell and connect to Exchange Online using the instructions at Connect to Exchange Online PowerShell.

Hide Groups from the GAL

Once connected, run the command below against the individual Group you want to hide.

Set-UnifiedGroup -Identity <UnifiedGroupIdParameter> -HiddenFromAddressListsEnabled $true

If you would rather hide all SDS created Groups from the GAL, run the below command instead.

$Groups = Get-UnifiedGroup -ResultSize Unlimited | ? {$_.PrimarySmtpAddress -like "Section_*"}
Foreach ($Group in $Groups) {Set-UnifiedGroup -Identity $Group.Name -HiddenFromAddressListsEnabled $true}

Hide Groups from Exchange Clients

Once connected you can run the below command to hide an individual Group from Exchange Clients and hide the Group from the GAL.

Set-UnifiedGroup -Identity <UnifiedGroupIdParameter> -HiddenFromExchangeClientsEnabled

If you would rather hide All SDS created Groups from Exchange Clients, run the below command instead.

$Groups = Get-UnifiedGroup -ResultSize Unlimited | ? {$_.PrimarySmtpAddress -like "Section_*"}
Foreach ($Group in $Groups) {Set-UnifiedGroup -Identity $Group.Name -HiddenFromExchangeClientsEnabled}

Note

Be sure to disconnect the remote PowerShell session when you're finished. If you close the Windows PowerShell window without disconnecting the session, you could use up all the remote PowerShell sessions available to you, and you'll need to wait for the sessions to expire. To disconnect the Exchange Online PowerShell session, run the following command.

Disconnect-ExchangeOnline