Powershell script to remove email address from Exchange 2007 user.
I have Exchange 2007 mailboxes that have been attached to Active Directory user accounts.
The users had mail contacts before attaching the mailboxes.
A script was run to delete the mail contacts, attach the mailboxes, and add the smtp addresses that were found in the mail contact.
There are now two similar addresses in the "email addresses" tab where one needs to be removed.
The two addresses look like this: "User1@test.internal.com" and "User2@test.internal.com"
I need a script which imports a csv where the user's alias is in one column and the desired email address alias is in the second column. The script calls the csv and removes the appropriate "@test.internal.com" for the specified users.
PowershellExchange
Last Comment
advserver
8/22/2022 - Mon
Chris Dent
So you have...
Alias,Email
SomeUser,SomeUser@test.internal.com
Is the address specified in the CSV the one you want to keep? Or the one you want to remove? And if it's the one to keep, everything else should be removed?
And you mention both contacts and users here, it makes little difference, but are these users or contacts?
Chris
advserver
ASKER
The contacts are gone and we are left with the Exchange 2k7 mailbox.
The Exchange 2k7 mailbox now has 2 similar email addresses User1@test.internal.com and User2@test.internal.com
User1@test.internal.com represents the address used in the mail contact which was deleted
User2@test.internal.com represents the address set by default when the Exchange 2k7 mailbox was created.
I need to have the User2@test.internal.com deleted for every user specified in a csv file.
"User2" is the alias of the user which would have to be called in the csv and as the user has two emails that end with "@test.internal.com" the full email address would probably have to be in the csv as well.
I know it's a random request but thank you for your time!
advserver
ASKER
I still wasn't that clear.
User2 = Exch2k7 Mailbox
Email addresses for User2: User2@internal.test.com, User1@internal.test.com
Need to have every specified user's alias email address deleted ie: User2@internal.test.com deleted
So you have...
Alias,Email
SomeUser,SomeUser@test.int
Is the address specified in the CSV the one you want to keep? Or the one you want to remove? And if it's the one to keep, everything else should be removed?
And you mention both contacts and users here, it makes little difference, but are these users or contacts?
Chris