Exchange SMTP Address Search

Hi All

Ive been building a script within exchange that allows me to search all SMTP entries. For some reason the script is failing now but was working fine on Friday. Any ideas what might be going on.

Get-Recipient -resultSize unlimited | select name -expand emailAddresses | where {$_.smtpAddress -match "SMTPAddress"} | Format-Table name, smtpaddress

Failing with what error message? What is the result and expected result?

Walking through each section of your command, the “| where {$.smtpAddress -match “SMTPAddress”}" part didn’t work, so I changed it to make sure that field wasn’t empty, so it changed it to "| ? {$.SmtpAddress -ne $null}”, see below.

 

get-recipient -resultsize unlimited | select name -expand emailaddresses | ? {$_.SmtpAddress -ne $null} | ft Name,SMTPAddress -auto