Rename computers based on MAC Address

Posted on 2010-01-12
Medium Priority
Last Modified: 2012-05-08
We have hundred of computers we image every month. It takes many days to go through this process of renaming the computers.  We have the mac addresses for all the computers.  Is there a vbs or cmd script I can run to rename all the computers based on mac address? I would like to run a script on a remote computer that is on the same subnet.

Eg: mac address = computer name
Question by:GSIAdmin
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
LVL 13

Expert Comment

ID: 26297214
LVL 18

Accepted Solution

mirtheil earned 2000 total points
ID: 26297288
I've used compname.exe (http://www.willowhayes.co.uk/) in the past in conjunction with a batch file in my Unattended Setup.  The batch file I used was:
ECHO Setting Computer Name
ECHO Please wait...
for /f "tokens=1" %%i IN ('compname /d ?m') do set MAC=%%i
IF %MAC% == 000000000000 compname /c machine1
IF %MAC% == 000000000000 compname /c machine2

Author Comment

ID: 26297631

Can I run this batch on any computer or must it be on the computer I am renaming?
Optimum High-Definition Video Viewing and Control

The ATEN VM0404HA 4x4 4K HDMI Matrix Switch supports 4K resolutions of UHD (3840 x 2160) and DCI (4096 x 2160) with refresh rates of 30 Hz (4:4:4) and 60 Hz (4:2:0). It is ideal for applications where the routing of 4K digital signals is required.

LVL 18

Expert Comment

ID: 26297713
I was running it on the computer being renamed during the Windows  installer.  You should be able to execute the batch file on the remote machine using something like PsExec although I haven't tried it.

Author Comment

ID: 26300384
I try above and still no luck.  Anyone else have a solution
LVL 18

Expert Comment

ID: 26300455
What behavior did you see?  Did it not change the name?  Did you reboot the remote machine after running the command?  

Author Comment

ID: 26300615

Thanks for the reply, this is what I got from the command prompt.  



C:\>ECHO Setting Computer Name
Setting Computer Name

C:\>ECHO Please wait...
Please wait...

C:\>for /F "tokens=1" %i IN ('compname /d ?m') do set MAC=%i
'compname' is not recognized as an internal or external command,
operable program or batch file.
compname was unexpected at this time.

C:\>IF  == 001E68AEF04E compname /c TEST1

Author Comment

ID: 26300685

It worked, I did not follow the instruction.  After I downloaded compnam.exe, I was able to rename my computer.  Tomorrow, I am going to test this on our network.  Will this allow me to rename all the computer all at once without going to each indivdual computers?

Featured Post

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

Monitor input from a computer is usually nothing special.  In this instance it prevented anyone from using the computer.  This was a preconfiguration that didn't work.
As companies replace their old PBX phone systems with Unified IP Communications, many are finding out that legacy applications such as fax do not work well with VoIP. Fortunately, Cloud Faxing provides a cost-effective alternative that works over an…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses
Course of the Month8 days, 23 hours left to enroll

765 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