Script to Rename Computers

Home Forums Scripting DOS Command Shell Script to Rename Computers

Viewing 1 post (of 1 total)
  • Author
    Posts
  • Avatar
    hodester
    Member
    #154479

    My company is in the process of renaming the systems and we have about 1200 units which need to be renamed. I am looking for a way/script that will rename the computers for me and still keep them on the domain. The current script I have requires me to enter the current system name and then the new system name. My current naming scheme is ABCD-1234-WXYZ and the new policy requires the name to be ABCDWX0YZ1234. (note I have added a 0 (zero) at the 7th character, this will need to be added in all names.) The current script I have is (it is a batch file;


    @echo
    off

    cls
    color 70
    Echo “|—————————————————|
    echo ” This Computer is “%computername%”
    echo “|—————————————————|
    echo “| |
    echo “|This Utility will Rename a computer on the Domain |
    echo “| it must be powered on and connected |
    echo “| to the network at the time |
    echo “| ***system admin*** |
    echo “|—————————————————|
    REM cd /d ….

    :redo

    rem ********************the following will ask for the compuer name **************************

    echo “*** TO QUIT TYPE Q”
    echo “oldcomputer %oldcomputer%”

    SET /P oldcomputer=Please enter the Current Computer Name :

    Rem *****************************************************************

    if exist “\%oldcomputer%c$” goto goodname

    echo ” %oldcomputer% ”

    pause

    :NotFound
    color c0
    echo ” you typed %oldcomputer%”

    echo ”
    echo ”
    echo “THE COMPUTER WAS NOT FOUND!!! Make Sure it is powered on ”
    echo “and on the network at this time”
    pause
    goto redo

    :goodname
    color 70

    echo ”
    echo ”
    echo ” The computer %oldcomputer% was found
    Echo ”
    echo ” Now we need the new computer name
    Echo ”
    SET /P newcomputer=What is the new name of the new computer :
    echo ”
    echo ” Your Username : %username%”
    echo ” The Current Computername: %oldcomputer%
    echo ” The New Computer Name: %newcomputer%
    echo ”
    echo ” You will now be prompted to enter your PASSWORD Twice:
    echo ”
    echo ”

    netdom renamecomputer %oldcomputer% /newname:%newcomputer% /userD:NV%username% /passwordd:* /usero:NV%username% /passwordo:* /reboot:600

    rem netdom renamecomputer %oldcomputer% /newname:%newcomputer% /userD:nv* /passwordd:* /usero:nv* /passwordo:* /reboot:600 /securepasswordprompt

    :stopp
    goto redo

    SET /P anotherrun=Would you like to rename another?(Y/N) :

    PAUSE[/CODE]end[CODE]

    @echo
    off

    cls
    color 70
    Echo “|


    |
    echo ” This Computer is “%computername%”
    echo “|


    |
    echo “| |
    echo “|This Utility will Rename a computer on the Domain |
    echo “| it must be powered on and connected |
    echo “| to the network at the time |
    echo “| ***system admin*** |
    echo “|


    |
    REM cd /d ….

    :redo

    rem ********************the following will ask for the compuer name **************************

    echo “*** TO QUIT TYPE Q”
    echo “oldcomputer %oldcomputer%”

    SET /P oldcomputer=Please enter the Current Computer Name :

    Rem *****************************************************************

    if exist “\%oldcomputer%c$” goto goodname

    echo ” %oldcomputer% “

    pause

    :NotFound
    color c0
    echo ” you typed %oldcomputer%”

    echo “
    echo “
    echo “THE COMPUTER WAS NOT FOUND!!! Make Sure it is powered on “
    echo “and on the network at this time”
    pause
    goto redo

    :goodname
    color 70

    echo “
    echo “
    echo ” The computer %oldcomputer% was found
    Echo “
    echo ” Now we need the new computer name
    Echo “
    SET /P newcomputer=What is the new name of the new computer :
    echo “
    echo ” Your Username : %username%”
    echo ” The Current Computername: %oldcomputer%
    echo ” The New Computer Name: %newcomputer%
    echo “
    echo ” You will now be prompted to enter your PASSWORD Twice:
    echo “
    echo “

    netdom renamecomputer %oldcomputer% /newname:%newcomputer% /userD:NV%username% /passwordd:* /usero:NV%username% /passwordo:* /reboot:600

    rem netdom renamecomputer %oldcomputer% /newname:%newcomputer% /userD:nv* /passwordd:* /usero:nv* /passwordo:* /reboot:600 /securepasswordprompt

    :stopp
    goto redo

    SET /P anotherrun=Would you like to rename another?(Y/N) :

    PAUSE[/CODE]end

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.