Domain name/ email address search in exchange by using Powershell

This topic contains 3 replies, has 3 voices, and was last updated by Profile photo of AniyaNetworks AniyaNetworks 9 months ago.

  • Author
    Posts
  • #36281
    Profile photo of AniyaNetworks
    AniyaNetworks
    Participant

    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.

  • #36288
    Profile photo of Stig Sörnsen
    Stig Sörnsen
    Participant

    Hi,

    Try including the wildcards like this:

    Get-Mailbox -Filter {Emailaddresses -like "*$Emailaddress*"}

    Best regards
    Stig

  • #36308
    Profile photo of Nagendra Narembally
    Nagendra Narembally
    Participant

    Try with the below syntax

    Get-Mailbox -Filter "emailaddresses -like '*$emailaddress*'"

  • #36316
    Profile photo of AniyaNetworks
    AniyaNetworks
    Participant

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

    Thanks guys taking time to solve my problem.

You must be logged in to reply to this topic.