Solved

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

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

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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 39

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Utilizing an array to gracefully append to a list of EmailAddresses
Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
In this video we show how to create a Contact 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 Recipients >> Contact ta…
In this video we show how to create a mailbox database 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 Servers >> Data…

706 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

19 Experts available now in Live!

Get 1:1 Help Now