Link to home
Create AccountLog in
Avatar of LaurentLyon

asked on

[Exchange 2010] delete string in all mailboxe's name


I'd like to list all my mailboxes in Exchange 2010 , and when i meet a string in the mailboxe's name , i d like to delete it

Exemple : mailbox  duponttotoherve
Replace by dupontherve

Avatar of Amit
Flag of India image

Question is not clear. Explain more.
Avatar of LaurentLyon


id like to replace all string "xxxxxx" in display name of all mailboxes

Exemple : hervexxxxxxdupont
Id like to replaceit  with it hervedupont
( delete xxxxxxx for each mailbox IF EXIST)

Not all the mailboxes have this string , only 60%

Is it clear ?

It seems you are referring to Email address policy in Exchange 2010. Check what email address policy is applied and modify it accordingly.
I d like a powershell script who rename all mailboxe with deleting the string in the name
Lauren let me ask you is there some Attribute that matched the same you want for those users ?

Amit: What lauren is saying let me explain in detail (Just an example)


So he wants your and my ID to be corrected and Symbols\etc to be removed

- Rancy
Yes , It s the same string on all the mailboxes
Thanks Rancy. A screenshot will give more details. Lauren , can post the screenshot.
Example :
Mailboxe 1 : alias herveSTRINGdupont
Mailboxe 2 : alias jeanSTRINGdupond
Mailboxe 3 : alias johnSTRINGlenon

 = => replace with

Mailboxe 1 : alias hervedupont
Mailboxe 2 : alias jeandupond
Mailboxe 3 : alias johnlenon

( delete "STRING" on all mailboxes which contains it )
In this situation you can use admodify tool

Read it properly, before making bulk changes, take the backup.
Amit dont mind but as u had asked earlier Admodify will work if we have another similar attribute that can replace the affected one

So Lauren do we have another Attribute that can replace the affected one

- Rancy
it s the same attribute to replace in all mailboxes
Admodify can do that for you.
I guess you didnt get me as what Amit said for the toll will work if i give it some Input to take :)

- Rancy
Try this.. I have added -WhatIf for testing, remove it to replace the string from mailbox alias..

Run the script from Exchange Management Shell..
$ST = "xxxxxx"
Get-Mailbox -ResultSize Unlimited | %{
If ($_.Alias -match $ST){
$NewAlias = $_.Alias -replace $ST
Set-Mailbox $_.Alias -Alias $NewAlias -WhatIf

Open in new window

Thanks Subsun
I d like to rename the DISPLAYNAME and  the NAME wich contains "XXXXX" in Active Directory Users

Avatar of SubSun
Flag of India image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account