ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Use PowerShell to hide mailboxes from the Global Address List in Office365

    IT Discussion
    office 365 powershell exchange online
    5
    8
    3.8k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A
      aburch
      last edited by

      [Thanks to Greg Hall for assisting me with this!]

      We recently underwent a corporate name change, which required us to migrate our users over to email addresses on the new domain.

      Because most users still require access to their old account, I was unable to remove those mailboxes, which created confusion for the majority of users who pull from the Global Address List, which displays all mailboxes on our corporate Office365 account. Despite a change in the naming convention from <first initial><lastname> to <firstname>.<lastname>, folks were still sending plenty of email to old user mailboxes, thwarting our efforts to wean them away.

      Initially I sought to segregate the old domain from the new using Address Book Policy, but found we had not defined certain parameters upon which New-AddressBookPolicy is dependent. So, moving away from that approach, and with the help of Greg Hall, I decided to simply hide the old mailboxes from the Global Address List - which worked perfectly. Here's how I did that . . .

      Connect to Office365 using the Azure Active Directory Module, then input:

      Get-User -Filter {Company -eq 'Microsoft'} | Get-Mailbox -resultsize unlimited | Set-Mailbox -HiddenFromAddressListsEnabled $true

      And don't forget your Distribution Groups!

      Export the list of group names to .CSV and input the following:

      Get-Content -Path C:\LocationOf.CSV | Set-DistributionGroup -HiddenFromAddressListsEnabled $true

      Bam. Done.

      Of course, we had not defined the "Company" value in our users' Exchange properties, but I'll discuss using PS to edit Exchange properties in another post.

      1 Reply Last reply Reply Quote 1
      • DashrenderD
        Dashrender
        last edited by Dashrender

        How does this effect the name.nk2 in Outlook? I'm guessing that people using Outlook and not OWA will still have the old addresses in name.nk2 and might still be sending email to the wrong address.

        JaredBuschJ gjacobseG 2 Replies Last reply Reply Quote 2
        • JaredBuschJ
          JaredBusch @Dashrender
          last edited by

          @Dashrender said:

          How does this effect the name.nk2 in Outlook? I'm guessing that people using Outlook and now OWA will still have the old addresses in name.nk2 and might still be sending email to the wrong address.

          I have always wanted a way to clean that file up remotely, but never wanted it enough to look into it.

          DashrenderD 1 Reply Last reply Reply Quote 1
          • DashrenderD
            Dashrender @JaredBusch
            last edited by

            @JaredBusch said:

            @Dashrender said:

            How does this effect the name.nk2 in Outlook? I'm guessing that people using Outlook and now OWA will still have the old addresses in name.nk2 and might still be sending email to the wrong address.

            I have always wanted a way to clean that file up remotely, but never wanted it enough to look into it.

            Frankly I'm more surprised that Outlook doesn't have some sort of tracking built into that file to watch for changes to the GAL and local address book for changes.

            Changes like the OP mention have created nightmares for me as users are complaining that things don't work. Then I have to either delete whole file, or teach them how to manually edit the file to remove the old entry.

            1 Reply Last reply Reply Quote 1
            • A
              aburch
              last edited by

              That's a good question!

              I don't think the name.nk2 file draws from the GAL, rather it's populated through use over time. To that end, we simply asked users to delete their AutoComplete cache early on and start over (I know, some were rather distraught, including our technician who sat and cleaned up the HR Manager's list personally!).

              I would definitely be curious to know if there's a way to simply edit the list, rather than manage it in broad strokes like delete, import and export. Though that doesn't seem to be the case.

              1 Reply Last reply Reply Quote 0
              • gjacobseG
                gjacobse @Dashrender
                last edited by

                @Dashrender said:

                How does this effect the name.nk2 in Outlook? I'm guessing that people using Outlook and not OWA will still have the old addresses in name.nk2 and might still be sending email to the wrong address.

                I'd say yes that is true.

                However I am of the understanding that the name.nk2 files has been retired in Office 2013 and forward.

                Not something I've followed or dev'ed into though.

                1 Reply Last reply Reply Quote 2
                • DashrenderD
                  Dashrender
                  last edited by

                  Well the name.nk2 file itself might be retired, but the autocomplete listings are still there and are not fixed when someone changes addresses.

                  I had this problem last year in Outlook 2013

                  ? 1 Reply Last reply Reply Quote 1
                  • ?
                    A Former User @Dashrender
                    last edited by A Former User

                    @Dashrender said:

                    Well the name.nk2 file itself might be retired, but the autocomplete listings are still there and are not fixed when someone changes addresses.

                    I had this problem last year in Outlook 2013

                    They only way to fix that would be to clear the auto complete list. That's solely based on the most common emailed addresses. It's per user and doesn't store on exchange in anyway (and isn't sync with OWA, OWA uses it's own list)

                    1 Reply Last reply Reply Quote 1
                    • 1 / 1
                    • First post
                      Last post