logo
search
Others

How to Hide Microsoft 365 Contacts from the GAL Using PowerShell

Tauseeq MagsiTauseeq Magsi Oct 10, 2026 869 views

Question details

The user needs a PowerShell command to hide a batch of over 1,000 imported contacts from the Microsoft 365 Global Address List without affecting unrelated existing contacts.

How to Hide Microsoft 365 Contacts from the GAL Using PowerShell
Product
Microsoft 365
Device & OS
not provided
Scenario
Hiding a large volume of newly imported contacts from the global directory securely.
Observed behavior
The imported contacts are currently visible in the Global Address List and need to be hidden via an appropriately scoped PowerShell command.
Before you start

Ensure you are connected to Exchange Online PowerShell as an administrator and have the correct permissions to modify contact attributes.

Solution 1Recommended

Use Set-Contact Cmdlet in Exchange Online PowerShell

Pipe the results of a scoped Get-Contact query into the Set-Contact cmdlet to hide contacts in bulk.

When dealing with thousands of imported contacts, PowerShell is the most efficient method. However, because piping Get-Contact directly will affect all returned items, you must carefully filter the scope so you do not accidentally hide unrelated organizational contacts from the Global Address List.

1
Connect to Exchange Online

Open PowerShell as an administrator and run the command to connect to Exchange Online using your Microsoft 365 admin credentials.

2
Verify the scope with Get-Contact

Before making changes, run a filtered Get-Contact command (e.g., filtering by a specific organizational unit, custom attribute, or import date) to list only the imported contacts.

3
Run the hide command

Execute the following command on your filtered list: Get-Contact | Set-Contact -HiddenFromAddressListsEnabled $true

4
Confirm the changes

Check the Exchange Admin Center or use PowerShell to verify that the target contacts now have their HiddenFromAddressListsEnabled attribute set to true.

Use Set-Contact Cmdlet in Exchange Online PowerShell
Command Scope Warning: Running 'Get-Contact | Set-Contact' without any filters will hide every single contact in your tenant. Always test the command on a single contact or a heavily filtered subset first.
Free Microsoft Office alternative

Manage Your Documents Efficiently with WPS Office

While Microsoft 365 handles complex Exchange admin tasks, you might be looking for a lightweight, free alternative for your daily document, spreadsheet, and presentation needs. WPS Office offers a highly compatible and familiar interface for managing your Office files without the subscription cost.

  1. 1. Download the Installer: Visit the official WPS Office website and download the free installer for your operating system.
  2. 2. Install WPS Office: Run the downloaded file and follow the on-screen prompts to complete the installation in minutes.
  3. 3. Open Your Microsoft Office Files: Launch WPS Office and directly open your existing .docx, .xlsx, or .pptx files with full formatting compatibility.
Fully compatible with Microsoft Office formats (Word, Excel, PowerPoint)Lightweight architecture that runs smoothly on almost any hardwareFamiliar user interface for seamless workflow migrationBuilt-in PDF editing capabilities at no extra cost
microsoft office alternative - wps office

Frequently Asked Questions

How can I filter the Get-Contact command to only target imported contacts?

You can use the -Filter parameter with Get-Contact or filter by an Organizational Unit (OU) if you are syncing from an on-premises Active Directory. This ensures you only pipe the newly imported contacts to the Set-Contact cmdlet.

How long does it take for the GAL to update after running the PowerShell command?

After successfully running the PowerShell command, it can take up to 24 hours for the Global Address List changes to propagate to all Outlook offline address books and Microsoft 365 client applications.

How do I unhide contacts from the GAL if I make a mistake?

You can reverse the process by running the same scoped PowerShell command but changing the parameter value to false: Get-Contact <Filter> | Set-Contact -HiddenFromAddressListsEnabled $false.