Domain name/ email address search in exchange by using Powershell

Hello , i would like to make a script that will help me to know, how many user is using this domain name as primary emails.

My script is :

$Emailaddress = Read-Host “`nPlease Enter the Email Addressess (e.g: financexx)”

Get-Mailbox -Filter {Emailaddresses -like “$Emailaddress”}

#Get-Mailbox -Filter {Emailaddresses -like “hollis”} (when i try this i am getting reply)

but my script is not returning any result. please advise.


Try including the wildcards like this:

Get-Mailbox -Filter {Emailaddresses -like “$Emailaddress”}

Best regards

Try with the below syntax

Get-Mailbox -Filter “emailaddresses -like ‘$emailaddress’”

Thank you guys,
Nagendra Narembally@ i tried your syntax and it did work. Thank you

Thanks guys taking time to solve my problem.