You can hide mail contacts from the GAL using Powershell with the Set-Mailcontact cmdlet. Example:
Set-MailContact -Identity Jim@blah.com -HiddenFromAddressListsEnabled $true
Hiding a Mail Contact from the Global Address List in Office 365
The form below will generate the correct PowerShell for you:
- Enter the email address of the contact that you would like to hide (or unhide)
- Copy the generated code into a PowerShell window.
- You will be prompted for your Office 365 Credentials.
- The contact will be changed.
Your Powershell session should look something like this:
If you found this post helpful, please rate it 😀
Zane says
Can you add to the list of contact addresses or do you need to duplicate the entire line
Set-MailContact -Identity bob@bob.com -HiddenFromAddressListsEnabled $true
for each user?
Thx! V helpful
Sam says
Hi
Could you please help me with hiding all contacts in office 365 instead of one contact
Thanks
Noah R. de Wit says
Sam,
After running the login commands:
$Cred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Cred -Authentication Basic -AllowRedirection
Import-PSSession $Session
to change the attribute in bulk in all mail contacts:
Get-MailContact | Set-MailContact -HiddenFromAddressListsEnabled $true
to verify changes:
Get-MailContact | select Name, Alias, HiddenFromAddressListsEnabled
jared says
Awesome. Thanks for this!