How to hide contacts from GAL by using PowerShell
1.Follow the article to access Exchange Online through PowerShell:
Connect Windows PowerShell to the Service
http://help.outlook.com/en-us/140/cc952755.aspx
- To hide a contact from Global Address List, type the cmdlet bellow
Command:
Set-Mailbox -Identity jv@itprodev.onmicrosoft.com -HiddenFromAddressListsEnabled $true
- To check if your contact is hidden for the address list, type the command bellow
Command:
Get-Mailbox -Identity jv@itprodev.onmicrosoft.com | fl
How to unhide all hidden contacts from GAL by using PowerShell script
Summary
Contacts that are hidden from Global Address List (GAL) are not visible to Office 365 Exchange Online users. This article provides a method that unhide all hidden contacts from GAL by using PowerShell script.
1.Follow the article to access Exchange Online through PowerShell:
Connect Windows PowerShell to the Service
http://help.outlook.com/en-us/140/cc952755.aspx
2. Export a list for contacts hidden from GAL by running the following cmdlet:
Command:
Get-Mailcontact -Filter {HiddenFromAddressListsEnabled -eq $true} | Select identity,alias,HiddenFromAddressListsEnabled | Export-Csv -Path C:\HiddenContacts.csv -NoTypeInformation
3. Unhide the contacts from C:\HiddenContacts.csv file by running the following cmdlet:
Command:
$users = import-csv C:\HiddenContacts.csv
Foreach($_ in $users) {Set-mailcontact $_.identity -HiddenFromAddressListsEnabled $false}
OR
Command:
Set-Mailbox -Identity jv@itprodev.onmicrosoft.com -HiddenFromAddressListsEnabled $false
More Information
Get-MailContact
http://technet.microsoft.com/en-us/library/bb124717.aspx
Set-MailContact
http://technet.microsoft.com/en-us/library/aa995950.aspx