Link to home
Start Free TrialLog in
Avatar of Grime121
Grime121

asked on

How Do I Rename Multiple Computers Using Their IP Address?

I have about 200 clients that occasionally get re-imaged. They do not belong to domains. They all have static IP addresses. Using the static IP addresses how could I write a script that would rename each computer? It doesn't matter what it names them... It would be nice if it named each one the same name every time I ran the script though I suppose. Is [HKEY_LOCAL_MACHINE\System\CurrentControlSet\control\ComputerName\] the only registry key I need to change in order to change a computer's name? If so, how could I write a batch script that would do something like this:

Go <MACHINE IP ADDRESS> and run regedit /s \\SERVER\PUBLICSHARE\CHANGECOMPUTERNAME<COMPUTER'S IP ADDRESS>.REG

For that example I would need a reg file for every computer though. I'm sure there is some way to do it with a variable instead.... Help?
Avatar of Lee W, MVP
Lee W, MVP
Flag of United States of America image

The computer name is not simply a registry entry.  You'll likely need to use the netdom command.  For some information on this, see:

http://www.ss64.com/nt/netdom.html
http://folk.uio.no/mlomholt/ymse/hjelp/win-netdom.txt

You might also want to try looking over this:
http://www.enterpriseitplanet.com/resources/scripts_win/article.php/3081771
Avatar of Longbow
Longbow

http://www.jsiinc.com/SUBA/tip0200/rh0285.htm

Here is the tool you need to change any computername.
You can download it from this link.

You can change a computername remotely with Psexec tool from the PsTools Suite found at http://www.sysinternals.com/ntw2k/freeware/pstools.shtml.

To automate the process from the image you need to script it.
I will suggest to have the mac address and the new computername
 in order to change it correctly.

Wich imaging system do you use ?
How do you define wich static address have each computer ?
Avatar of Grime121

ASKER

We use Symantec Ghost 8.0. All of the static IP addresses are assigned by the DHCP server according to MAC address. I already use pstools a lot, and I've been trying to figure out a way to use it for this problem since I know you can run it according to IP address. I think this will work. Here is what I'm going to use in a script for each computer:

psexec.exe \\192.168.0.x babtize <new name>
Oh, one more thing. Will Netware cause any problems with this? We use Novell on these computers.
Your commandline must  have the path & filename in quotes.
The options can follow the last quote.

It is not an so easy thing.
Now i know you connect to differents domains :
When changing the username you need to put each computer in a workgroup, then change the computername, then put it back in the domain. It will take two or three reboots. The keyboard and mouse must be locked to prevent the users to use the computer during this session.
My script is a batch file with 116 lines of code.
It needs five executables to do all the job.

The solution i gave you is a solution to change computernames to the fly, not after ghosting a PC.
Or maybe you have a script wich does the job in one execution.
But you need to have a report because you do not know wich computer were turned on at this time.

The solution i used to ghost my training rooms is a list (.txt file) with all computernames and macaddresses in two columns.

We had a DOS tool wich read the macaddress and the computername from a floppy disk ant put the value in a environment variable.

The variable can be sent to Ghostwalker in order to change accordingly the computername.
Well, all of the computers are already in workgroups. We don't use a domain for those computers. I use psexec quite frequently, so I'm pretty familiar with it. Since they are not in domains, can't I just simply run that 'babtize' script to rename them? I found an option in Ghost one time to rename computers randomly after they are imaged, but I looked for about 15 minutes yesterday and could not find it. Plus, it would be nice to assign the computers the same name every time they are imaged rather than a random name every time. I'm not too worried about which computers are turned on at the time. The computers are in labs at a university. After we image them we can just run the script for that lab that will include the renaming commands. Does this sound like a good solution?
ASKER CERTIFIED SOLUTION
Avatar of Longbow
Longbow

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Wow, I found something even better: http://mytoolsandstuff.tripod.com/wsname.html

That will rename them by doing a reverse dns lookup and using whatever the PTR record is for that IP address. Very slick. Of course, the reverse lookup zone has to be set to not allow dynamic updates.