Solved

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

Posted on 2014-01-29
6
2,600 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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Windows 10 came with  a lot of built in applications, Some organisations leave them there, some will control them using GPO's. This Article is useful for those who do not want to have any applications in their image (example:me).
In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

679 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