-HiddenFromAddressListsEnabled

Welcome Forums General PowerShell Q&A -HiddenFromAddressListsEnabled

This topic contains 4 replies, has 3 voices, and was last updated by

Ron
 
Participant
1 year, 5 months ago.

  • Author
    Posts
  • #72907

    Participant
    Points: 0
    Rank: Member

    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

    Participant
    Points: 0
    Rank: Member

    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

    Participant
    Points: 34
    Rank: Member
    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

    Participant
    Points: 0
    Rank: Member

    Thank you Mark, we must have posted simultaneously : )

  • #73193
    Ron

    Participant
    Points: 0
    Rank: Member
    | 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.

The topic ‘-HiddenFromAddressListsEnabled’ is closed to new replies.