• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1360
  • Last Modified:

After domain rename, user logon points to old domain

I just completed a successful domain rename.  However, I just noticed that most all of the users AD account's logon name still point to the old domain.  In other words, if you view the properties of a users AD account, the user logon name is username@olddomain. I can manually click the drop down arrow and choose the new domain, however, there are about 500 user accounts that need to be changed.

How can I change this property for all accounts at one time?

Thanks!
1
A.V.
Asked:
A.V.
  • 2
  • 2
1 Solution
 
Krzysztof PytkoSenior Active Directory EngineerCommented:
You can simply use for that MS DS Tools. On a DC in command-line type

to prepare users list
dsquery user -samid * -limit 0 | dsget user -samid | find /v "dsget" | find /v "samid" >>c:\users.txt

Open in new window


and now, you can simply update users
for /f %i in (c:\users.txt) do dsquery user -samid %i | dsmod user -upn %i@NewDNSDomainName -c

Open in new window


example new UPN %i@testenv.local

and UPN will be changed

Regards,
Krzysztof
1
 
A.V.Lead EngineerAuthor Commented:
Thanks so much for your help..
When I run this command
for /f %i in (c:\users.txt) do dsquery user -samid %i | dsmod user -upn %i@NewDNSDomainName -c
                                           
I get an error stating -c is an unknown parameter...any ideas why?
0
 
Krzysztof PytkoSenior Active Directory EngineerCommented:
No problem, you're welcome :)

strange -c means continue if any error found. Try to skip that -c and check if it would work for you :)

Krzysztof
0
 
A.V.Lead EngineerAuthor Commented:
This worked perfectly.  Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now