• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 701
  • Last Modified:

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?
0
Grime121
Asked:
Grime121
  • 4
  • 3
1 Solution
 
Lee W, MVPTechnology and Business Process AdvisorCommented:
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
 
LongbowCommented:
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
 
Grime121Author Commented:
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
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
Grime121Author Commented:
Oh, one more thing. Will Netware cause any problems with this? We use Novell on these computers.
0
 
LongbowCommented:
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
 
Grime121Author Commented:
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
 
LongbowCommented:
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
 
Grime121Author Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now