How to Hide Microsoft 365 Contacts from the GAL Using PowerShell
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.

- 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.
Ensure you are connected to Exchange Online PowerShell as an administrator and have the correct permissions to modify contact attributes.
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.
Open PowerShell as an administrator and run the command to connect to Exchange Online using your Microsoft 365 admin credentials.
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.
Execute the following command on your filtered list: Get-Contact | Set-Contact -HiddenFromAddressListsEnabled $true
Check the Exchange Admin Center or use PowerShell to verify that the target contacts now have their HiddenFromAddressListsEnabled attribute set to true.

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. Download the Installer: Visit the official WPS Office website and download the free installer for your operating system.
- 2. Install WPS Office: Run the downloaded file and follow the on-screen prompts to complete the installation in minutes.
- 3. Open Your Microsoft Office Files: Launch WPS Office and directly open your existing .docx, .xlsx, or .pptx files with full formatting compatibility.

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.




