Solved

Active Directory - modify 'msExchHomeServerName' Attribute for 100+ users

Posted on 2014-01-29
6
2,554 Views
Last Modified: 2014-01-30
I have recently discovered that for some reason the 'msExchHomeServerName' Attribute in Active Directory is incorrect for a number of users.
 
I know how to modify this manually in ADSI Edit but is there a simply / script that would assist me in performing this task a lot quicker.
 
Thank you for your assistance.
0
Comment
Question by:the_omnific
  • 3
  • 2
6 Comments
 
LVL 6

Expert Comment

by:Ramakrishna Prabhu
ID: 39819979
0
 
LVL 40

Expert Comment

by:footech
ID: 39820049
You should be able to set this with PowerShell with a command like
Set-ADUser -Identity username -Replace @{msExchHomeServerName="/o=Org/ou=First Administrative Group/cn=Configuration/cn=Servers/cn=EXCHANGE"}

Open in new window

To automate it further, you would want perform a query for the desired users and pass that info along to the Set-ADUser command instead of manually specifying the username.  Something like
Get-ADUser -filter {msExchHomeServerName -eq "/o=wrongOrg/ou=First Administrative Group/cn=Configuration/cn=Servers/cn=EXCHANGE"} | Set-ADUser -Replace @{msExchHomeServerName="/o=Org/ou=First Administrative Group/cn=Configuration/cn=Servers/cn=EXCHANGE"} -whatif

Open in new window

I have included the -whatif parameter at the end so that no changes will be made if you run the above.  Remove it when you want to run for real.
0
 
LVL 1

Author Comment

by:the_omnific
ID: 39823020
The second command is not working. Any ideas?

Get-ADUser -filter {msExchHomeServerName="/o=BUSINESS/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Configuration/cn=Servers/cn=ADRXGE02"} | Set-ADUser -Replace @{msExchHomeServerName="/o=BUSINESS/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Configuration/cn=Servers/cn=ASYDXGE03"}

Open in new window


Get-ADUser : Error parsing query: 'msExchHomeServerName="/o=BUSINESS/ou=Exchange Administrative Group 
(FYDIBOHF23SPDLT)/cn=Configuration/cn=Servers/cn=ADRXGE02"' 

Error Message: 'Operator Not supported: =' at position: '21'.
At line:1 char:1
+ Get-ADUser -filter {msExchHomeServerName="/o=BUSINESS/ou=Exchan ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ParserError: (:) [Get-ADUser], ADFilterParsingException
    + FullyQualifiedErrorId : Error parsing query: 'msExchHomeServerName="/o=BUSINESS/ou=Exchange Administrative Group (FYDIBOHF2 
   3SPDLT)/cn=Configuration/cn=Servers/cn=ADRXGE02"' Error Message: 'Operator Not supported: =' at position: '21'.,Microsoft.ActiveDirectory.Management.Commands.GetADUser

Open in new window

0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 40

Accepted Solution

by:
footech earned 500 total points
ID: 39823176
Like it says, the operator is not supported (referring to "=").  As in my example you have to use "-eq" for the comparison operator.
Get-ADUser -filter {msExchHomeServerName -eq "/o=BUSINESS/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Configuration/cn=Servers/cn=ADRXGE02"} | Set-ADUser -Replace @{msExchHomeServerName="/o=BUSINESS/ou=Exchange Administrative Group (FYDIBOHF23SPDLT)/cn=Configuration/cn=Servers/cn=ASYDXGE03"}

Open in new window

0
 
LVL 1

Author Comment

by:the_omnific
ID: 39823185
Perfect, it works!
0
 
LVL 1

Author Closing Comment

by:the_omnific
ID: 39823186
Thank you!
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A brief introduction to what I consider to be the best editor for PowerShell.
In-place Upgrading Dirsync to Azure AD Connect
This video discusses moving either the default database or any database to a new volume.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

809 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