-HiddenFromAddressListsEnabled

Tagged: 

This topic contains 4 replies, has 3 voices, and was last updated by Profile photo of Ron Ron 1 week ago.

  • Author
    Posts
  • #72907
    Profile photo of ChrisN
    ChrisN
    Participant

    I have 940 user accounts in one OU in Active Directory Windows 2012 R2 that needs hiding from the address list. I need a script, but I am struggling. Any ideas?

  • #72911
    Profile photo of ChrisN
    ChrisN
    Participant

    Identify accounts:

    get-aduser -filter {-not(msExchHideFromAddressLists -eq $true)} -searchbase "OU=xxxxxx,dc=internal,dc=xxxxx,dc=org,dc=uk" -searchscope onelevel

    Apply change

    | set-aduser -replace @{msExchHideFromAddressLists="TRUE"}

    Resolved with some help from a friend.

  • #72913
    Profile photo of Mark Prior
    Mark Prior
    Participant
    Get-DistributionGroup -OrganizationalUnit "Contoso.contoso.com/....../........./DL Location" | Set-DistributionGroup -HiddenFromAddressListsEnabled $TRUE
    

    this should do the job

    ohh just saw it was for users, looks like your sorted now anyway

  • #72916
    Profile photo of ChrisN
    ChrisN
    Participant

    Thank you Mark, we must have posted simultaneously : )

  • #73193
    Profile photo of Ron
    Ron
    Participant
    | set-aduser -replace @{msExchHideFromAddressLists="TRUE"}

    This does not actually hide the user in the GAL. The flag will be set, the box will be checked in Exchange, but the user is still visible. Hiding the entry also requires modification to showInAddressBook. If you don't want to use the Exchange commands, you could just clear it, but the best way is to use the appropriate Exchange command to hide it, ex: Set-Mailbox, Set-MailUser.

You must be logged in to reply to this topic.