Windows OS Hub
  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux
  • Home
  • About

Windows OS Hub

  • Windows
    • Windows 11
    • Windows Server 2022
    • Windows 10
    • Windows Server 2019
    • Windows Server 2016
  • Microsoft
    • Active Directory (AD DS)
    • Group Policies (GPOs)
    • Exchange Server
    • Azure and Microsoft 365
    • Microsoft Office
  • Virtualization
    • VMware
    • Hyper-V
  • PowerShell
  • Linux

 Windows OS Hub / Exchange / Export Exchange or Office 365 Global Address List (GAL) to CSV

March 15, 2024

Export Exchange or Office 365 Global Address List (GAL) to CSV

Let’s consider some ways of exporting the Exchange Global Address List (GAL) or Offline Address Book to a text CSV file. GAL contains all email addresses of your on-prem Exchange organization or Exchange Online (Office 365) tenant. You can use the CSV file with the contact list from the corporate address book to transfer and import contacts to third-party email clients or email services.

Let’s deal with some export tools: these can be Exchange Admin Center, PowerShell, MS Access, Outlook, or csvde utility.

Contents:
  • How to Export Global Address List to CSV in an On-Prem Exchange Server
  • Exporting Global Address List from Exchange Online (Microsoft 365)
  • Export Global Address List from Outlook or Access

How to Export Global Address List to CSV in an On-Prem Exchange Server

The easiest way is to export the address list directly from the Exchange Admin Center (EAC) console. To do this, go to Recipients -> Mailbox section, click …, and select Export data to a CSV file.

exchange admin center on-premises: export address list to csv file

Next, you can select the properties (attributes) of users you want to export to a CSV file.

exporting user email adresses to csv in exchange

But, you can export only users’ email addresses in this way. To export addresses of distribution groups, you need to go to Groups and export from there (similarly to Contacts, Resources, Shares).

To get the address list in the domain, you can use the PowerShell cmdlet Get-Recipient. For example, our task is to display the list of user names, their SMTP addresses, and phone numbers. Connect to your Exchange Server from PowerShell and run the command:

Get-Recipient| Select-Object Name,PrimarySmtpAddress, Phone

Powershell Get-Recipient

To display only the Default Global Address List entries, use this filter:

$filter = (Get-GlobalAddressList 'Default Global Address List').RecipientFilter
Get-Recipient -ResultSize unlimited -RecipientPreviewFilter $filter | Select-Object Name,PrimarySmtpAddress, Phone

Get-Recipient results are limited to 1000 objects. To get more addresses, use the -ResultSize Unlimited parameter.

To exclude from the list the entries hidden from the address book (HiddenFromAddressLists attribute). User the Export-CSV cmdlet in order to export results to the CSV file:

Get-Recipient -RecipientPreviewFilter $filter | Where-Object {$_.HiddenFromAddressListsEnabled -ne $true} | Select-Object Name,PrimarySmtpAddress, Phone | Export-CSV c:\exchange\GAL.csv -NoTypeInformation

You can also export the list of mailboxes in GAL as follows:

Get-mailbox -results unlimited | Where-Object {$_.AddressListMembership -like “*Default Global Address List*”} | Select-Object DisplayName,UserPrincipalName,AddressListMembership,HiddenFromAddress

To export data from Active Directory, you can use the csvde.exe console tool.

The command to display user data with their e-mail addresses can look like this:

CSVDE -r "(&(objectClass=person)(mail=*))" -l displayName,proxyAddresses –f Exchange-GAL.csv

As a result, you get an address list like this:

“CN=LondTest,OU=Service,DC=corp,DC=woshub,DC=com",LondTest,smtp: [email protected]
You can use the PowerShell cmdlets Get-ADUser and Get-ADGroup from the AD PowerShell module to get a list of users and groups with SMTP addresses. Let’s export a list of users with SMTP addresses (proxyaddresses AD attribute) from a specific OU:

Get-ADUser -Filter * -SearchBase 'OU=London,OU=UK,DC=woshub,DC=com' -Properties proxyaddresses | Select-Object Name, Proxyaddresses| Export-CSV C:\PS\AD_OU_Export_GAL.csv

Exporting Global Address List from Exchange Online (Microsoft 365)

There are no built-in tools to export all GAL content in the Exchange Online web interface (https://admin.exchange.microsoft.com/). However, you can export a list of user mailboxes, distribution groups, or resource mailboxes to a CSV file one by one. To do this, go, for example, to Recipient -> Mailboxes, and select Export.

office365 (microsoft 365): export mailbox list to excel or csv file

Similarly, you can export a list of contacts, distribution lists, and mail-enabled groups.

It is much easier and more convenient to export the Global Address List from your Exchange Online (Microsoft 365) tenant using PowerShell. Connect to your Exchange Online tenant with the EXO v3 module:

Connect-ExchangeOnline

List the available Global Address Lists using the command:

Get-GlobalAddressList | Select-Object Name

Get-GlobalAddressList - powershell

In our example, only the ‘Default Global Address List’ exists. This address list includes all mail-enabled objects in the organization (users, groups, distribution groups).

Let’s get the filter of the Global Address List:

$Filter = (Get-GlobalAddressList 'Default Global Address List').RecipientFilter

The following filter is used to add objects to the GAL:

((Alias -ne $null) -and (((ObjectClass -eq 'user') -or (ObjectClass -eq 'contact') -or (ObjectClass -eq 'msExchSystemMailbox') -or (ObjectClass -eq 'msExchDynamicDistributionList') -or (ObjectClass -eq 'group') -or (ObjectClass -eq 'publicFolder'))))

Now you can get a list of all SMTP addresses from the Exchange Online tenant and export them to a CSV file:

Get-Recipient -RecipientPreviewFilter $Filter | Select-Object Name, PrimarySmtpAddress,RecipientType | Export-CSV C:\PS\Export_Office365_GAL.csv -NoTypeInformation

export global address list with powershell to csv in exchange online

All possible types of recipients in Exchange Online have been exported to the CSV file: UserMailbox, MailUser, MailUniversalDistributionGroup, MailContact, and DynamicDistributionGroup.

Export Global Address List from Outlook or Access

If you don’t have privileged permissions in Exchange, you can export the organization’s global address list from the user’s computer using programs from MS Office/Office 365.

You cannot export the contents of the Global Address List directly from Outlook. The only workaround for exporting GAL content to a file is to add all recipients from the organization’s address book to the personal Contacts list (Address Book –> Global Address List -> CTRL+A -> Add to contacts). Then you can export Outlook contacts to CSV via the Import-Export feature (File -> Open & Export -> Import/Export). You will have to copy the original contacts to an Outlook temporary contact folder. As you can see, this method is not very convenient.

adding global address list to personal contacts in outlook

And finally, the least evident, but quite simple and clear way to export the GAL for a non-admin user is to use an Exchange connection in Microsoft Access.

  1. Run Microsoft Access and select File->Open in its menu;
  2. Select Exchange() in file types;Connect Exchange via Access
  3. In the list of sources select Global Address List; Import Exchange GAL to Microsoft Access
  4. You will get a flat Access table with data from the Exchange address book;
  5. Now you can export this data from the database to a CSV file.

All you have to do is import the CSV file you received in Excel and modify it as you need.

3 comments
3
Facebook Twitter Google + Pinterest
Azure and Microsoft 365ExchangeMicrosoft OfficePowerShell
previous post
High Non-Paged Pool Memory Usage (Leak) in Windows
next post
Automatically Add Static Routes After Connecting to VPN

Related Reading

Outlook Keeps Asking for Password on Windows

March 17, 2024

Get a List of Mailboxes a User Has...

March 15, 2024

How to Cleanup, Truncate or Move Log Files...

March 17, 2024

How to Delete or Rename Default Mailbox Database...

March 17, 2024

Fix: Microsoft Outlook Search Not Working on Windows...

March 17, 2024

Search and Delete Emails from User Mailboxes on...

March 15, 2024

How to Hide Users and Groups from the...

March 15, 2024

Sending Email with SMTP Authentication via Telnet or...

March 12, 2024

3 comments

tondalaeois March 30, 2016 - 9:13 am

Great post!

You can also export using Outlook or GUI Exchange admin tools:

http://www.sysadmit.com/2016/03/exchange-exportar-lista-global-de-direcciones.html
 

Reply
TheBigT42 February 14, 2020 - 9:03 pm

PowerShell

Get-mailbox -results unlimited | Where-Object {$_.AddressListMembership -like “*Default Global Address List*”} | Select-Object DisplayName,UserPrincipalName,AddressListMembership,HiddenFromAddress | export-csv gal.csv

Reply
davrocks777 July 9, 2024 - 5:48 pm

For Exchange Online:
Get-Recipient -RecipientPreviewFilter $Filter | Select-Object Displayname, PrimarySmtpAddress,RecipientType,HiddenFromAddressListsEnabled | Export-CSV C:\Export_Office365_GAL.csv -NoTypeInformation

Reply

Leave a Comment Cancel Reply

join us telegram channel https://t.me/woshub
Join WindowsHub Telegram channel to get the latest updates!

Recent Posts

  • Map a Network Drive over SSH (SSHFS) in Windows

    May 13, 2025
  • Configure NTP Time Source for Active Directory Domain

    May 6, 2025
  • Cannot Install Network Adapter Drivers on Windows Server

    April 29, 2025
  • Change BIOS from Legacy to UEFI without Reinstalling Windows

    April 21, 2025
  • How to Prefer IPv4 over IPv6 in Windows Networks

    April 9, 2025
  • Load Drivers from WinPE or Recovery CMD

    March 26, 2025
  • How to Block Common (Weak) Passwords in Active Directory

    March 25, 2025
  • Fix: The referenced assembly could not be found error (0x80073701) on Windows

    March 17, 2025
  • Exclude a Specific User or Computer from Group Policy

    March 12, 2025
  • AD Domain Join: Computer Account Re-use Blocked

    March 11, 2025

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Outlook Keeps Asking for Password on Windows
  • Checking User Sign-in Logs in Entra ID (Microsoft 365)
  • How to Manually Configure Exchange or Microsoft 365 Account in Outlook 365/2019/2016
  • Search and Delete Emails from User Mailboxes on Exchange Server (Microsoft 365) with PowerShell
  • Fix: Microsoft Outlook Search Not Working on Windows 10/11
  • Blank Sign-in Screen in Office 365 Apps (Outlook, Teams, etc.)
  • Removing Built-in Teams Chat in Windows 11
Footer Logo

@2014 - 2024 - Windows OS Hub. All about operating systems for sysadmins


Back To Top