question

Al-Amran avatar image
0 Votes"
Al-Amran asked KyleXu-MSFT commented

Set homemdb value for bulk users in Exchange 2013 environment

Our 2013 exchange environment has been corrupted due to fire incident.

We have tried to restore database from backup as recovery state when we have gotten the database was dirty shutdown state. We tried soft recovery but it's failed. Then we had tried hard recovery and it's came back in clean shut down state.

But it will take tom much time from backup restore. Then we have decided to set all mail users database because all users database is missing.

We tried set-mailbox command to assign database for one user but it's getting error.

After then we have added value in homemdb of one user from ADSI edit, after then user mailbox is connected in database. User is able to login his/her mailbox.

The big challenge is we have 6000 users. How can we add homemdb value for all users by using powershell command or any script?


office-exchange-server-administrationoffice-exchange-online-itprooffice-exchange-server-connectivityoffice-exchange-hybrid-itpro
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

What was the error? and the command you were running

0 Votes 0 ·

1 Answer

KyleXu-MSFT avatar image
0 Votes"
KyleXu-MSFT answered KyleXu-MSFT commented

@Al-Amran

Prepare a csv file contains the AD account that you want to modify:
144720-qa-kyle-10-33-01.png

Then, run script below to modify homeMdb for them:

 $users = Import-Csv c:/temp/users.csv
 $homeMdb = ""
    
 foreach ($user in $users){    
     Set-ADUser $user.Name -replace @{homeMdb=$temp}
 }

144817-qa-kyle-10-36-49.png


If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.



· 3
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@KyleXu-MSFT

Thanks for your reply.

The CSV contains username can be multiple which can not unique but if we use the Email address in CSV it will unique and can't cause any conflict.

Can you please share the script based on the email address to which data pulls from CSV?

0 Votes 0 ·

The Set-ADUser command only supported with those values:
145400-qa-kyle-17-31-14.png
You could use email address in the CVS file(Don't change the Title "name"), but you will need to run this script in EMS rather than PowerShell. We need to use EMS to convert the Email address to SamAccountName which is also unique.

 $users = Import-Csv c:/temp/users.csv
  $homeMdb = ""
        
  foreach ($user in $users){    
      Set-ADUser (Get-Mailbox $user.Name).SamAccountName -replace @{homeMdb=$homeMdb}
  }

Due to lack of HomeMDB, you will see warning below when run this script in EMS, it doesn't effect the running of script:
145458-qa-kyle-17-40-54.png


0 Votes 0 ·

@Al-Amran
I am writing here to confirm with you any update about this thread now?
If the above suggestion helps, please be free to accept it as an answer for helping more people.

0 Votes 0 ·