PowerShell - script does mail adress exist

Copper Contributor

Hello, i need to know if does exist mail adress eg. test@test. I need to use PowerShell. 
and if mail exist how a can add alias?


Thanks for help. 

5 Replies
are you asking for a powershell script that check if that email exists on your exchange ?

@eliekarkafy  yeah, In domain of our company.

Here's a PowerShell script to check if an email exists or not in Active Directory:

$email = "email address removed for privacy reasons" # replace with the email you want to check
$exists = Get-ADUser -Filter {EmailAddress -eq $email} -Properties EmailAddress

if ($exists) {
Write-Host "The email address $email exists in Active Directory."
} else {
Write-Host "The email address $email does not exist in Active Directory."


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily.

I try and its on every email adress in our domain resposne they doesnt exist.
are you running this PowerShell on your active directory?