Last active
January 12, 2022 23:32
-
-
Save constructor-igor/e80e24c5501c3a222283 to your computer and use it in GitHub Desktop.
Powershell: list of all entries from Outlook Global Address List (GAL)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Microsoft.Office.Interop.Outlook.Application] $outlook = New-Object -ComObject Outlook.Application | |
$entries = $outlook.Session.GetGlobalAddressList().AddressEntries | |
$count = $entries.Count | |
$count | |
foreach($entry in $entries) | |
{ | |
[console]::WriteLine("{0}: {1}", $entry.Name, $entry.GetExchangeUser().MobileTelephoneNumber) | |
} |
Is this problem solved?
Thanks for the code , I can use it.
My GAL is under 20K so I just iterate thru $entries multiple times
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can someone help me expand on this code? What I would like to do is only hit the exchange server 1 time and also look for a specific filter like "title" and "location" I've modified this code slightly to create an object but there is 62,000 + contacts on my GAL. I'd like to only search for contacts with a specific title and then also a specific location / city. Below is my updated code, but when I run it, it still continues to try to pull all 62,000+ contacts. Is there a way to insert filters on what I'm looking for without pulling all the contacts?
`[Microsoft.Office.Interop.Outlook.Application] $outlook = New-Object -ComObject Outlook.Application
$entries = $outlook.Session.GetGlobalAddressList().AddressEntries
$count = $entries.Count
$count
$objs = @()
foreach($entry in $entries)
{
$attributes = $entry.GetExchangeUser()
$city = $attributes.city
$title = $attributes.jobtitle
$email = $attributes.primarySMTpaddress
$name = $attributes.name
}`