Rename multiple computers with a VBScript

I need to rename about 1500 computers on my domain. We are changing our desktop / laptop naming convention. The new naming convention will be Site Code - Serial number. I want to put the User Name - Computer Model - Asset Tag. I know I can get the Serial number from WMI, the rest of the info I will supply from a text file. I have seen several Computer Renaming VBScript, but it's been a long time since i've written a script. I could really use some assistance.
NSM_SupermanAsked:
Who is Participating?
 
Jared LukerConnect With a Mentor Commented:
The renaming of a computer is pretty straight forward....

This script should change the name locally and in AD.  You can add to it anyway you wish in order for it to do what you want it to.

Here is the code to do it..

http://www.microsoft.com/technet/scriptcenter/scripts/ad/computer/cptrvb14.mspx
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
 
Set colComputers = objWMIService.ExecQuery _
    ("Select * from Win32_ComputerSystem")
 
For Each objComputer in colComputers
    err = objComputer.Rename("WebServer")
Next

Open in new window

0
 
Jared LukerCommented:
This will still involve someone with the local and AD rights to touch and log into the computer, but the script can make it much less painful.
0
 
rejoinderCommented:
Can you please post a sample line from the text file that will be read?
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.

All Courses

From novice to tech pro — start learning today.