I am in Need to have a powershell script to check if any email address exist or not.

Vinay Bhatia 151 Reputation points
2022-06-02T00:06:09.173+00:00

Hello Guys,

I am looking for help to create a script to check if from given email addresses in CSV already exist or not.
If it exist we need to add 1 like firstname.lastname1@xyz .com

Regards,
Vinay

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

Answer accepted by question author
  1. Rich Matheisen 48,036 Reputation points
    2022-06-02T02:22:09.33+00:00

    You can use "Get-Recipient" to get all mail-enabled objects (mail users, mailboxes, mail contacts, and distribution groups). Each will have an EmailAddresses property that is an array of all the email addresses assigned to that object.

    You can use the email addresses in your CSV as the -Identity parameter value on the Get-Recipient cmdlet. If the email address from the CSV is present in the AD you'll have the answer as to whether or not it exists.

    Determine the type of recipient that uses the email address and use the appropriate Set- cmdlet to add the new email address.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.