Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've inherited this stupid name convention:


It doesn't tell me anything about the location (floor, department). John left the company months ago. Computers from one city moved to another city, but the name hasn't been changed.

How can you rename 100+ computers when you want to create a new naming convention?

share|improve this question

3 Answers 3

up vote 5 down vote accepted

Sure thing. The NETDOM utility is "your friend" in this case. You can use a startup script to rename computers.

Some docs on NETDOM are here:

I could see a really simplistic script like this:

@echo off
... more machines ...
IF NOT "%NEWNAME%"=="" NETDOM renamecomputer member /newname:%NEWNAME% /userd:USER-TO-PERFORM-RENAME-UNDER /password:PASSWORD-FOR-THAT-USER

Once all the computers are renamed you can take the startup script away. It shouldn't be too "expensive" to run on computers that have already been renamed. If you were worried about that you could do the "trapdoor" technique whereby the script ends with the computer placing itself into a group that has been denied rights to execute the script.

  • Create a group in AD-- say "Computer Rename Complete".
  • Modify the permission on the group to include "Domain Computers - Write / Add Self as Member"
  • In the simplistic batch-file script above add the line at the end:
IF NOT "%NEWNAME%"=="" NET GROUP "User Creation Script Complete" /DOMAIN /ADD %COMPUTERNAME%$

You'll see that group "grow" member computers as it runs on each machine. To stop the script from running on computers where it's already run, add a permission to the GPO that assigns the startup script "Computer Rename Complete - Deny Apply Group Policy". Then the script will run once on each machine.

What are your destination names going to be like? If you're like me and like Dell service tag numbers you could do something like this (in VBScript):

Option Explicit
Dim objWMIService, strNewName, objShell, objNetwork
Set objShell = CreateObject("WScript.Shell")
Set objNetwork = CreateObject("WScript.Network")

' Obtain the service tag
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") 
For Each objSMBIOS in objWMIService.ExecQuery("SELECT * FROM Win32_SystemEnclosure")
    strNewName = objSMBIOS.SerialNumber 

' Check for empty string
If (strNewName = "") Then WScript.Quit

' Does the computer need to be renamed?
If (UCase(strNewName) <> UCase(objNetwork.ComputerName)) Then    
     objShell.Run "NETDOM renamecomputer member /newname:" & strNewName & " /userd:USER-TO-PERFORM-RENAME-UNDER /password:PASSWORD-FOR-THAT-USER"
End If

That script could just run all the time, and would constantly rename computers that weren't named based on their service tags... heh heh. (I'm not sure that I'd actually do that, and if I did I'd put more sanity checking in the script.)

share|improve this answer
Thanks, I'll give it a go next week. –  onesysadmin Jul 25 '09 at 9:04

You could do this through PowerShell. In Excel, make a file with two columns, one for the old name, one for the new name. Add a header row oldname and newname. Save it as a CSV (mylist.csv) then run this in powershell:

function renameAndReboot([string]$computer, [string]$newname)
        $comp = gwmi win32_computersystem  -computer $computer
        $os   = gwmi win32_operatingsystem -computer $computer


Import-Csv mylist.csv

foreach ($entry in $list)

...core code came from here.

share|improve this answer
Assuming all the computers are powered-on and reachable over the network at the time you run that script it would work. –  Evan Anderson Jul 24 '09 at 1:16

Computers from one city moved to another city, but the name hasn't been changed.

This is a weakness of naming schemes which attempt to describe location, owner, function, etc. Things change. So you end up either renaming computers often (and rebooting every time!), or having a naming scheme which falls into disrepair as time passes.

May I suggest the description field? alt text

You can list computers and their descriptions easily: alt text

More on this at my blog.

share|improve this answer
It looked to me like the poster already knew that using location-dependent computer names was a bad idea-- hence the statement: "Computers from one city moved to another city, but the name hasn't been changed." Perhaps I read too much into the poster's statement, but it seemed to me like he knew that it wasn't a good idea to use location-dependent names. –  Evan Anderson Jul 24 '09 at 12:00
Evan, maybe. The wording makes it hard to tell. But others will read this question, so I did want to suggest an alternative that seems to go often missed. I've seen a lot of orgs still trying to make location/function/user-based naming schemes work. –  quux Jul 25 '09 at 20:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.