PowerShell command to hide Office 365 user from Outlook Global Address List

Please provide me with the PowerShell command to hide an Office 365 user from the Outlook Global Address List.
IT GuyNetwork EngineerAsked:
Who is Participating?
ITSysTechSenior Systems AdministratorCommented:
Here is an example.

to hide
Set-ADUser paulie -Replace @{msExchHideFromAddressLists=$true}

to unhide:
Set-ADUser paulie -Replace @{msExchHideFromAddressLists=$false}

Todd NelsonSystems EngineerCommented:
If the associated AD object of the EXO mailbox is synchronized from on premise (via AAD Connect), use the solution that ITSysTech provided.

However, if it is a cloud-only account, connect to EXO via PowerShell and run this command...

Get-Mailbox -Identity "Mailbox" | Set-Mailbox -HiddenFromAddressListsEnabled $true

Open in new window

You will then need to exercise patience before it no longer appears in the GAL.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.