Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Change Windows 2003 Server Name via command line?

Status
Not open for further replies.

daveh777

IS-IT--Management
Oct 16, 2005
21
GB
hi folks,

does anyone know how to change from a command prompt the name of a windows 2003 server?

could this be put into a script or batch file?

cheers
Dave
 
I think you can, but it is not straight forward. Especially if you want to move computer to a new domain, you need to use NetDom plus registry tool, so you need a good registry guy to pinpoint the reg key for you, they should be in:

HK_CLASSES_ROOT
HK_LOCAL_MACHINE
 
You can use netdom.exe

netdom RENAMECOMPUTER /?

should point you in the right direction. It can only be used on a member server NOT a DC

HTH - Stiddy
 
Oh yea, you asked if this could be put into a script. Sure it could. Are you renaming multiple servers. Do they all have the same common username and password as the built in administrator?

HTH - Stiddy
 
Hi Stiddy,

I'm only looking to change the name on member servers, I've to create a script which will quickly rename about 400 servers which are all imaged. the administrator name and password will be the same on all servers. Don't worry about domain names or anything, none of these servers are going into a domain, their for a project my company is doing.

cheers
Dave
 
If you do it via batch file you could create one batch file , and a list of hostnames or ipaddresses and the new name in a text file like such:

my_servers_to_rename.txt
REM the order is old_name space new_name
server1 serverA
server2 serverB
server3 serverC
server4 serverD
server5 serverE


Rename_servers.bat
REM This batch file will take input from the my_servers_to_rename.txt file and rename servers. Note that this batch file is fully dependant on DNS being able to resolve the old computer names.

for /f "tokens=1-2" %%a in (my_servers_to_rename.txt) do echo NETDOM RENAMECOMPUTER %%a /NewName:%%b /UserO:Administrator /PasswordO:p@ssw0rd /Force /REBoot:25


REM This is untested so play with it first but you should get the idea. Hope this helps...







HTH - Stiddy
 
Hi Stiddy,

sorry I've been unable to try it, I've been working on another project, when I get into work on Monday I'll give it a go. Thanks for your help

Dave
 
Hi Stiddy,

not had time to try it yet but would the script also work for Windows XP machines?

Dave
 
Netdom.exe you must first install the Windows Server 2003 Support Tools.

netdom computername oldname.dpetri.net /add:newname.dpetri.net
 
Sure it will. I would just obviously try a test workstation before you attempt to change more than one workstation or server.

HTH - Stiddy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top