Mar 18 2023 01:19 AM - edited Mar 18 2023 01:54 AM
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.
Mar 18 2023 03:09 AM
Mar 18 2023 03:13 AM
@eliekarkafy yeah, In domain of our company.
Mar 18 2023 03:24 AM - edited Mar 18 2023 03:30 AM
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.
Mar 18 2023 03:41 AM
Mar 18 2023 03:55 AM