After domain rename, user logon points to old domain

Posted on 2012-08-16
1 Endorsement
Last Modified: 2012-08-24
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?

Question by:nytekgirl
    LVL 39

    Accepted Solution

    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

    LVL 7

    Author Comment

    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?
    LVL 39

    Expert Comment

    by:Krzysztof Pytko
    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 :)

    LVL 7

    Author Closing Comment

    This worked perfectly.  Thanks!

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    #Citrix #Citrix Netscaler #HTTP Compression #Load Balance
    Don’t let your business fall victim to the coming apocalypse – use our Survival Guide for the Fax Apocalypse to identify the risks and signs of zombie fax activities at your business.
    This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
    This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

    731 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

    17 Experts available now in Live!

    Get 1:1 Help Now