how to remotely rename domain computers

November 16, 2009 | By voidzzz | Filed in: How-To, Tutorial, Windows, Windows 2003, Windows 2008, Windows 7, Windows Vista, Windows XP.

This how to will show you how to rename domain computers avoiding the hassle of walking to every domain computers to rename them.

I’ll make it quick and simple to you (as most of you expected) :
Prerequisite :
If you’re using Windows XP, download Windows XP Support Tools from here

  • Start > Run > type in “notepad” (without the quotes) > Enter
  • Copy the following vbs script code and paste it to your just-opened notepad :

    'Author : www.configuration-guide.com
    'On Error Resume Next
    Set oFSO = CreateObject("Scripting.FileSystemObject")
    set WSHShell = wscript.createObject("wscript.shell")
    Dim sNewName
    Dim sOldName
    Dim nTotalComputer
    Dim i
    Dim sUserName
    Dim sPassword
    sUserName = InputBox("Insert Username with Administrator rights" & vbCr & vbLf & "Username must be in DOMAIN\username format","http://www.configuration-guide.com")
    sPassword = InputBox("Insert Password for username : " & sUserName,"http://www.configuration-guide.com")
    nTotalComputer = InputBox("Number of computers to be renamed","http://www.configuration-guide.com")
    i = 1
    for i = i to nTotalComputer
    sOldName = InputBox("Old Computer Name" & vbCr & vbLf & "Computer # " & i & " from " & nTotalComputer,"http://www.configuration-guide.com")
    sNewName = InputBox("New Computer Name" & vbCr & vbLf & "Old Computer Name : " & sOldName,"http://www.configuration-guide.com")
    Call WSHShell.Run("netdom renamecomputer " & sOldName & " /newname:" & sNewName & " /userd:" & sUserName & " /passwordd:" & sPassword & " /usero:" & sUserName & " /passwordo:" & sPassword & " /force ")
    next
  • Save the file as renamecomputers.vbs (or anything you like but keep the .vbs extension)

That’s it … go give it a try … (still find a way to import and use list of computers from txt or csv file)


Tags: , ,

3 comments on “how to remotely rename domain computers

  1. fabio says:

    I was tested and worked fine with windows 7.

    • voidzzz says:

      Hi Fabio, thanks for your confirmation.
      Did you do anything else (install some system tools, etc) before run the script or just directly run the script from win 7 ?

  2. voidzzz says:

    Actually I managed to import list and do this automatically. All you need to do is make a spreadsheet with two column, the first will be for old computer name, the second for new computer name.

    The script will automatically rename the computers all at once.
    BUT … I forgot where did I save the script … LOL
    Will try to find it and post the update here

Leave a Reply

Your email address will not be published. Required fields are marked *