Registered member login:
Register Now
Altirigos » Deployment Solution » Scripting/Tools/Docs » Computer Name Change

» Current Poll
Do you leave the Aclient enabled?
YES - 82.31%
107 Votes
NO - 17.69%
23 Votes
Total Votes: 130
You may not vote on this poll.
» Stats
Members: 9,499
Threads: 11,754
Posts: 55,313
Top Poster: Nick (4,981)
Welcome our newest member, anthony.hardy
» Online Users: 34
0 members and 34 guests
No Members online
Most users online at once 294, 06-30-2007 at 12:24 PM.
» March 2010
S M T W T F S
28 1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31 123
Reply
Old 05-14-2007, 04:54 PM   #1 (permalink)
 
Status: Junior Altiris Admin
Join Date: 05-18-2005
Location: GLENDALE, CA
Age: 30
Posts: 12


Computer Name Change

I am looking to change all the Computer names in our environment to a different standard.

Our current PC names look like the AB-C12345. I want to keep the "12345" and append something new to the front of it. It would look like DEF-12345.

Any ideas on how to do this? My vbscript knowledge is poor.
Kota is offline   Reply With Quote
Old 05-14-2007, 06:06 PM   #2 (permalink)
 
LordofthePatch's Avatar
 
Status: Site Administrator
Join Date: 02-16-2005
Location: The Shire
Posts: 3,078


If a computer name is ABC12345 and you want to change it to DEF12345 I would be inclined to use Regular Expressions to isolate the numeric values as a string and then append a new character string to the front. Are all machines in your environment named this consistently (i.e. name begins with characters and ends in digits)?
__________________
The Mac motto: "Anything you can do I can do better; I can do anything better than you."
LordofthePatch is offline   Reply With Quote
Old 05-14-2007, 06:13 PM   #3 (permalink)
 
Status: Junior Altiris Admin
Join Date: 05-18-2005
Location: GLENDALE, CA
Age: 30
Posts: 12


I would say 80 percent of our computers are named the same. I understand what you are saying about regular expressions and appending the numeric but I don't know how to do that in VBscript. I don't know the syntax at all.
Kota is offline   Reply With Quote
Old 05-15-2007, 06:59 AM   #4 (permalink)
 
Status: Super Altiris Admin
Join Date: 11-09-2006
Location: London
Posts: 724


Quote:
Originally Posted by Kota
I would say 80 percent of our computers are named the same. I understand what you are saying about regular expressions and appending the numeric but I don't know how to do that in VBscript. I don't know the syntax at all.
Nor do I.

I'd install the Windows XP Support tools and use the NETDOM command as follows:

netdom renamecomputer %COMPUTERNAME% /newnameEF-%COMPUTERNAME:~-5% /force

Run the script in DS with an account that is a member of the Administrators Local Security Group on each PC and that has the rights to change computer names in the AD.

You probably have to reboot the PC after installing the Support Tools. More info on NETDOM is given in Microsoft KB article 298593.

I got the info on using the :~ stuff from here:

http://www.ss64.com/ntsyntax/varsubstring.html
andykn is offline   Reply With Quote
Old 05-15-2007, 09:04 AM   #5 (permalink)
 
Nick's Avatar
 
Status: Altiris Architect (Site Founder)
Join Date: 01-01-2005
Location: RDU, North Carolina, USA
Posts: 4,981


How about using the following query (Thanks to John Doyle for the help!) on your express database to change the display name in the DS console to what you want the systems to be renamed to.

Code:
UPDATE dbo.computer
SET [name] = REPLACE([name],N'ABC-',N'DEF-')
WHERE [name] LIKE N'ABC-%'
Now create a job called Rename in the DS console
Create a new Task in the job to Modify Configuration
Select Microsoft Networking
Select Use token for computer name
Select Token %NAME% which is default
Select Workgroup or Domain
Select Finish
__________________
Scire potentia est (knowledge is power)
Nick is offline   Reply With Quote
Old 05-15-2007, 10:49 AM   #6 (permalink)
 
Status: Junior Altiris Admin
Join Date: 05-18-2005
Location: GLENDALE, CA
Age: 30
Posts: 12


Shouldn't the Replace statement be like this?

REplace([Name], 'ABC-', 'DEF')

I don't know where the N came from in your statement.
Kota is offline   Reply With Quote
Old 05-15-2007, 10:52 AM   #7 (permalink)
 
Status: Junior Altiris Admin
Join Date: 05-18-2005
Location: GLENDALE, CA
Age: 30
Posts: 12


Quote:
Originally Posted by andykn
Nor do I.

I'd install the Windows XP Support tools and use the NETDOM command as follows:

netdom renamecomputer %COMPUTERNAME% /newnameEF-%COMPUTERNAME:~-5% /force

Run the script in DS with an account that is a member of the Administrators Local Security Group on each PC and that has the rights to change computer names in the AD.

You probably have to reboot the PC after installing the Support Tools. More info on NETDOM is given in Microsoft KB article 298593.

I got the info on using the :~ stuff from here:

http://www.ss64.com/ntsyntax/varsubstring.html
I don't want to have to install the support tools onto 2000 PC's. I don't think this would work unless you can install them on a share.
Kota is offline   Reply With Quote
Old 05-15-2007, 11:12 AM   #8 (permalink)
 
Nick's Avatar
 
Status: Altiris Architect (Site Founder)
Join Date: 01-01-2005
Location: RDU, North Carolina, USA
Posts: 4,981


Quote:
Originally Posted by Kota
Shouldn't the Replace statement be like this?

REplace([Name], 'ABC-', 'DEF')

I don't know where the N came from in your statement.
The N denotes that the subsequent string is in Unicode (the N actually stands for National language character set). Which means that you are passing an NCHAR, NVARCHAR or NTEXT value, as opposed to CHAR, VARCHAR or TEXT.

I tested this out on my lab and it worked without a problem.
__________________
Scire potentia est (knowledge is power)
Nick is offline   Reply With Quote
Old 05-15-2007, 12:49 PM   #9 (permalink)
 
Status: Junior Altiris Admin
Join Date: 05-18-2005
Location: GLENDALE, CA
Age: 30
Posts: 12


I just tested this out. Worked like a charm. Thanks for all the help.
Kota is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Powered by vBadvanced CMPS v3.0 RC2

All times are GMT -4. The time now is 04:46 PM.


Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
vB.Sponsors
Altirigos