Solved

How Do I Rename Multiple Computers Using Their IP Address?

Posted on 2004-09-21
8
666 Views
Last Modified: 2008-02-01
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?
0
Comment
Question by:Grime121
  • 4
  • 3
8 Comments
 
LVL 95

Expert Comment

by:Lee W, MVP
ID: 12120046
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
0
 
LVL 10

Expert Comment

by:Longbow
ID: 12120561
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 ?
0
 
LVL 1

Author Comment

by:Grime121
ID: 12122234
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>
0
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
LVL 1

Author Comment

by:Grime121
ID: 12122270
Oh, one more thing. Will Netware cause any problems with this? We use Novell on these computers.
0
 
LVL 10

Expert Comment

by:Longbow
ID: 12122429
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.
0
 
LVL 1

Author Comment

by:Grime121
ID: 12123622
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?
0
 
LVL 10

Accepted Solution

by:
Longbow earned 500 total points
ID: 12124392
Yes, you can use it directly sinds you do not have to access a domain.
Psshutdown can terminate the job.

Ghostwalker is the Ghost's tool wich can change the SID and can give a computername to the computer before the first logon.
I do not remember the exact name of the file. But it is near. Ghstwlkr.exe maybe.
It is a DOS application.

If the computer needs the presence of a local administrator while ghosting, running the script locally is a good solution.

Or if you already know the IP addresses used for the network you can automate the process. See my above post.
If MAC = "XXX" Then baptize NewComputername.
One line by computer.

Here is the link to a Visual Basic Script wich gives you any info about a Network Card.
http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=45
From this point your ghost image can automate the process.
0
 
LVL 1

Author Comment

by:Grime121
ID: 12129858
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.
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If your system is showing symptoms of browser hijacks or 'google search redirects' check out my other article (http://rdsrc.us/u3GP7A) first and run the tool TDSSKiller (http://rdsrc.us/GDBBs4) to get rid of the infection. Once done, and if the …
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

791 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