Probably the easiest way would be to use a regex, something like this:
$address.SmtpAddress -notmatch "oldsmtp1.com|oldsmtp2.com|oldsmtp3.com|oldsmtp4.com"
This should match any addresses not ending with any of the listed domains.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I am using the following script to remove an old secondary address. It is working fine. I would like to include 6 more old addresses (oldsmtp2.com, oldsmtp3.com, oldsmtp4.com, etc.) in this script to be remove. Would someone mind showing me how to do this? Thank you.
Probably the easiest way would be to use a regex, something like this:
$address.SmtpAddress -notmatch "oldsmtp1.com|oldsmtp2.com|oldsmtp3.com|oldsmtp4.com"
This should match any addresses not ending with any of the listed domains.
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more