I am trying to get a list of all email addresses that we have registered in our on-prem Exchange but I want to exclude all of the X400 type addresses. I have tried all of the following commands:
Get-Recipient | select name,recipienttype -expand emailaddresses | select name,recipienttype,prefix,addressstring,isprimaryaddress | where -property prefix -eq 'SMTP'
Get-Recipient | select name,recipienttype -expand emailaddresses | select name,recipienttype,prefix,addressstring,isprimaryaddress | where {$_.prefix -eq 'SMTP'}
Get-Recipient | select name,recipienttype -expand emailaddresses | select name,recipienttype,prefix,addressstring,isprimaryaddress | where-object {$_.prefix -eq 'SMTP'}
Get-Recipient | select name,recipienttype -expand emailaddresses | where-object {$_.prefix -eq 'SMTP'} | select name,recipienttype,prefix,addressstring,isprimaryaddress
Get-Recipient | select name,recipienttype -expand emailaddresses | where-object -property Prefix -eq 'SMTP' | select name,recipienttype,prefix,addressstring,isprimaryaddress
If I exclude the where-object, it returns everything fine. What am I missing? I am using the Exchange Management Shell running Powershell 5.1.