• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Tachytelic.net

  • Sco Openserver
    • Sco Unix Support
    • SCO Openserver Installation ISOs
    • SCO Openserver Binaries
    • Add a Hard Drive to an Openserver 5 Virtual Machine
    • Install SCO Vision SQL-Retriever ODBC Driver on Windows 10
    • License Expired on Virtual SCO Openserver Installation
    • How to reset the root password on SCO Openserver 5
  • Scripting
    • PowerShell
      • Add leading zeros
      • Check if a File Exists
      • Grep with Powershell
      • Create Environment Variables
      • Test for open Ports
      • Append to a Text File
    • VBScript
      • Check if a File Exists
      • lpad and rpad functions
      • Windows Update E-Mail Notification
  • Office 365
    • Connect to Office 365 with PowerShell
    • Add or remove an email alias using Powershell
    • Change Primary email address of Active Directory user
    • How to hide an AD user from the Global Address List
    • How to hide mail contacts from the Global Address List
    • Change the primary email address for an account with PowerShell
    • Change Primary email address of an AD User
    • Grant a single user access to access to all calendars
    • Forward email to an external address using Powershell
    • Convert shared mailbox to user mailbox with Powershell
  • Get in Touch
  • About Me
    • Privacy Policy

Office 365: Hide mail contacts from the Global Address List(GAL)

September 30, 2013 by Paulie 4 Comments

You can hide mail contacts from the GAL using Powershell with the Set-Mailcontact cmdlet. Example:

Set-MailContact -Identity [email protected] -HiddenFromAddressListsEnabled $true

Hiding a Mail Contact from the Global Address List in Office 365

The form below will generate the correct PowerShell for you:

  1. Enter the email address of the contact that you would like to hide (or unhide)
  2. Copy the generated code into a PowerShell window.
  3. You will be prompted for your Office 365 Credentials.
  4. The contact will be changed.

Your Powershell session should look something like this:
Image of Powershell session hiding a Mail Contact from the GAL

If you found this post helpful, please rate it 😀

Related

Filed Under: Office 365, Scripts & Utilities, Technical Posts Tagged With: Office 365, Powershell

Reader Interactions

Comments

  1. Zane says

    April 29, 2014 at 2:10 am

    Can you add to the list of contact addresses or do you need to duplicate the entire line

    Set-MailContact -Identity [email protected] -HiddenFromAddressListsEnabled $true

    for each user?

    Thx! V helpful

  2. Sam says

    May 2, 2014 at 11:23 am

    Hi

    Could you please help me with hiding all contacts in office 365 instead of one contact

    Thanks

  3. Noah R. de Wit says

    May 12, 2014 at 3:51 pm

    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

  4. jared says

    October 27, 2015 at 2:48 pm

    Awesome. Thanks for this!

Leave a Reply Cancel reply

Primary Sidebar

Link to my LinkedIn Profile
Go to mobile version