K B
asked on
PowerShell: Remove Email Address with .local suffix
I am attempting to take a list of users via CSV and remove all email addresses with .local in it.
Via AD PowerShell, Exchange Management Shell or Quest Shell I would like to loop through a CSV to accomplish this
Via AD PowerShell, Exchange Management Shell or Quest Shell I would like to loop through a CSV to accomplish this
ASKER
It's just a small amount of users I need to do this for. I need to leave multiple users untouched hence the CSV
I see.
In that case you might need to create a has table based on the initial data and loop through that.
However I'm afraid I'm in and out of meetings for the upcoming several hours. if no one will provide a solution till then I'll try to whip up a script for you. can you supply me with a dummy CSV for testing?
In that case you might need to create a has table based on the initial data and loop through that.
However I'm afraid I'm in and out of meetings for the upcoming several hours. if no one will provide a solution till then I'll try to whip up a script for you. can you supply me with a dummy CSV for testing?
ASKER
Thank you David. The CSV I speak of would be the user's samAccountName or UPN and that's it (I believe). Please tell me if this makes sense. I could put together a sample CSV but it would just be something like this:
John
Fred
Harry
Sam
Bryce
Or...
John@contoso.com
Fred@contoso.com
Harry@contoso.com
Sam@contoso.com
Bryce@contoso.com
----
Most of the users in the list will have a contoso.local in their proxyaddresses (AD) (or email addresses in Exchange (2010)). We also have Quest cmdlets at our disposal. AD, Exchange or Quest cmdlets would be great.
Thank you again!
K.B.
John
Fred
Harry
Sam
Bryce
Or...
John@contoso.com
Fred@contoso.com
Harry@contoso.com
Sam@contoso.com
Bryce@contoso.com
----
Most of the users in the list will have a contoso.local in their proxyaddresses (AD) (or email addresses in Exchange (2010)). We also have Quest cmdlets at our disposal. AD, Exchange or Quest cmdlets would be great.
Thank you again!
K.B.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If it's the 2nd one, why would you need a CSV? you can simply spool through your entire list of users and use this PS script
Open in new window
This will remove entries that has *@yourdomain.local from all mailboxes while leaving all other email addresses intact, perfect for situations where a certain OU had two domain suffixes and one was decommissioned.
Hope that helps.