Forum Discussion
jakubnula
Mar 18, 2023Copper Contributor
PowerShell - script does mail adress exist
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.
- are you asking for a powershell script that check if that email exists on your exchange ?
- jakubnulaCopper Contributor
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.