Solved

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

Posted on 2014-01-29
6
2,781 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 
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

Office 365 Training for IT Pros

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

Here's a look at newsworthy articles and community happenings during the last month.
This process allows computer passwords to be managed and secured without using LAPS. This is an improvement on an existing process, enhanced to store password encrypted, instead of clear-text files within SQL
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 …
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …
Suggested Courses

630 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