Closed Robs90 closed 1 year ago
@Robs90
Thanks for the detailed breakdown. This logic makes sense. When I have time, I will test and push this commit.
Ryan
Great find, @Robs90 !
Same issue was posted about a year ago incl another solution but yours looks cleaner :)
Addressed by latest commit...
When using the Parameter ExcludeSharedMailboxContacts, some Users get excluded even though they are returned by Get-EXOMailbox and are present in the Variable $Contactlist.
We found that the comparison between the results of Get-EXOMailbox and $Contactlist is Case sensitive. This results in excluding a User, when the WindowsEmailAddress is written using Capital Letters (First.Lastname@Domain.com) and the PrimarySMTPAddress is written in lower Case (first.lastname@domain.com). The script does not see a Match, and this User is skipped in the Contact List.
We found that when using the parameter ExcludeSharedMailboxContacts, the following line (Line 66 of Get-GALContacts.ps1) should be changed:
OLD (skipping Users where the Case does not match):
$ContactList = $ContactList | Select-Object DisplayName,FirstName,LastName,Title,Company,Department,WindowsEmailAddress,Phone,MobilePhone | Where-Object {$EmailAddressList.Contains($.WindowsEmailAddress)}
NEW (which ignores the Case in which the Emailaddress is written):
$ContactList = $ContactList | Select-Object DisplayName,FirstName,LastName,Title,Company,Department,WindowsEmailAddress,Phone,MobilePhone | Where-Object {$EmailAddressList -Contains $.WindowsEmailAddress}
Using the Contains Parameter in the second format, is not Case Sensitive. The Functionality however stays the same.