@ECHO OFF echo **************************************************************** echo * * echo * This will rename a domain computer and automatically * echo * make the appropriate changes in Active Directory. Although * echo * this method is well-tested, use at your own risk. * echo * Make sure that you run this command from a Domain Controller * echo * or a domain member that has the NETDOM program installed. * echo * NETDOM is installed as part of the Windows Support Tools MSI.* echo * * echo * If you would like to abort this operation, you may do * echo * so by pressing the 'Q' key at any prompt. (case sensitive) * echo * * echo **************************************************************** echo * Rent-A-Nerd, Inc. Nick Lauve * echo **************************************************************** echo * echo * :start :machineprompt set MACHINE= set /P MACHINE=* Computer to be renamed: %=% if "%MACHINE%"=="Q" GOTO done if "%MACHINE%"=="" GOTO machineprompt REM echo Computer %MACHINE% has been selected. echo * echo **************************************************************** echo * :newnameprompt set NEWNAME= set /P NEWNAME=* New computer name: %=% if "%NEWNAME%"=="Q" GOTO done if "%NEWNAME%"=="" GOTO newnameprompt REM echo Computer %MACHINE% will be renamed to %NEWNAME% echo * echo **************************************************************** echo * :userdprompt set USERD= echo * Enter a username with sufficient privileges set /P USERD=* (ex. DOMAIN\Username): %=% if "%USERD%"=="Q" GOTO done if "%USERD%"=="" GOTO userdprompt REM echo User %USERD% selected. echo * echo **************************************************************** echo * :passworddprompt set PASSWORDD= echo * Enter the password for this account set /P PASSWORDD=* (password will be visible): %=% if "%PASSWORDD%"=="Q" GOTO done if "%PASSWORDD%"=="" GOTO passworddprompt REM echo The operation will be performed using account %USERD% and password %PASSWORDD% echo * echo **************************************************************** echo * :rebootprompt set REBOOT= set /P REBOOT=* Seconds to wait before reboot: %=% if "%REBOOT%"=="Q" GOTO done if "%REBOOT%"=="" GOTO rebootprompt REM echo Computer will be automatically rebooted after %REBOOT% seconds. echo * echo **************************************************************** echo * echo * Please review the following and press 'r' to continue echo * echo * The computer currently named %MACHINE% echo * will be renamed to %NEWNAME% echo * by user %USERD% echo * using the password %PASSWORDD% echo * and will be rebooted after %REBOOT% seconds. echo * echo **************************************************************** echo * set /P EXECUTE=* Press the 'r' key to execute the command, or any other key to exit: %=% if "%EXECUTE%"=="r" (GOTO execute) ELSE (GOTO done) if "%EXECUTE%"=="R" (GOTO execute) ELSE (GOTO done) :execute echo * echo * executing... echo * netdom renamecomputer %MACHINE% /newname:%NEWNAME% /userD:%USERD% /passwordD:%PASSWORDD% /userO:%USERD% /passwordO:%PASSWORDD% /reboot:%REBOOT% /force :done echo * echo * Done. echo * echo **************************************************************** set /P ANOTHER=Would you like to rename another computer(y/n)?: %=% if "%ANOTHER%"=="y" GOTO start if "%ANOTHER%"=="Y" GOTO start set /P CLOSE=Press any key to exit exit