Solved

Exchange 2007 - Management power shell

Posted on 2014-01-30
2
288 Views
Last Modified: 2014-01-30
Can you tell me what is the cmdlet for this result? See file Picture1

For each maibox display nam contains (DGATI), I want to replace by (DGARI)

What is the cmdlet for execute this?
Picture1.jpg
0
Comment
Question by:dgswin
2 Comments
 
LVL 9

Expert Comment

by:Mahesh Sharma
ID: 39820608
Give a try to this:

1. Export all mailbox with matching condition to csv file.

Get-Mailbox -resultsize unlimited | where-object {$_.CustomAttribute1 -eq "<Value>" -and $_.DisplayName -Match 'DGATI' } | Select Alias, DisplayName | Export-Csv c:\output.csv

2. Not open CSV & replace all DGATI with DGARI
If csv contains " with all reocrds, replace them with null value. Remove first row as well.

3. Import the csv back to mailboxes.

$Temp = Import-Csv c:\output.csv
Foreach ($tmp in $temp) {Get-Mailbox $tmp.Alias | Set-Mailbox -DisplayName $tmp.DisplayName}

Always Try in lab first
0
 
LVL 68

Accepted Solution

by:
Qlemo earned 500 total points
ID: 39820732
Besides point 2 is probably a typo, that procedure is overcomplicated. PowerShell can do this in one go.
Get-Mailbox -resultsize unlimited |
  where-object {$_.CustomAttribute1 -eq 'D. G. resources humaines et resources informationelles' -and $_.DisplayName -like '*DGATI*' }  |
  % {
    Set-Mailbox $_ -DisplayName $_.Displayname.Replace('DGATI', 'DGARI')
 }

Open in new window

You can add the -whatif to Set-Mailbox to simulate the change only.
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Easy CSR creation in Exchange 2007,2010 and 2013
Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
In this video we show how to create an email address policy in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Mail Flow…
how to add IIS SMTP to handle application/Scanner relays into office 365.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now