Why we need to set mailnickname for Hiding users from Global Address List (GAL)?

Eaven HUANG 2,191 Reputation points
2022-12-14T01:08:05.2+00:00

Dear experts,

I'm exploring the way to hide some disabled users from our GAL, we are using AAD Connect to sync our on-prem objects to Office Exchange online.
I was in the impression that we need to firstly set the value of mailnickname for that user before setting the msexchhidefromaddresslists=$true.

What is the relationship behind? I'm not really sure why mailnickname will affect the GAL.
Thanks a lot for your advice.

Exchange Online
Exchange Online
A Microsoft email and calendaring hosted service.
6,182 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Vasil Michev 119.7K Reputation points MVP Volunteer Moderator
    2022-12-14T07:59:06.243+00:00

    The reason you need to first set an alias/mailnickname value is because of the default rules in AAD Connect. Without this property, the object will not be recognized as an Exchange recipient, and thus all Exchange related rules will be skipped. In turn, this means that in order to update any Exchange-related property via AAD Connect, you need to have mailnickname populated.

    1 person found this answer helpful.
    0 comments No comments

  2. Amit Singh 5,306 Reputation points
    2022-12-14T07:23:41.007+00:00

    Please confirm whether the disabled mailbox can be returned with the following command:

    Get-User -ResultSize unlimited | where {$_.UserAccountControl -eq 'AccountDisabled,NormalAccount' -and $_.RecipientType -eq 'UserMailbox'}  
    

    If it works, please run the following command to meet your requirement:

    Get-User -ResultSize unlimited | where {$_.UserAccountControl -eq 'AccountDisabled,NormalAccount' -and $_.RecipientType -eq 'UserMailbox'} | Set-Mailbox -HiddenFromAddressListsEnabled $true
    
    0 comments No comments

  3. Yuki Sun-MSFT 41,376 Reputation points Moderator
    2022-12-14T08:29:00.83+00:00

    Hi @Eaven HUANG ,

    I was in the impression that we need to firstly set the value of mailnickname for that user before setting the msexchhidefromaddresslists=$true.

    Yes, it's true and below is an official article with some explanation for reference:
    Changes to msExchangeHiddenFromAddressList attribute not updated against recipient object in Exchange Online
    270449-1.png


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.