Solved

Rename Domain Computer

Posted on 2006-07-11
5
718 Views
Last Modified: 2008-02-01
Hi Guys

I am rolling out about 50 or so new PC's in my organization. These will be replacing existing machines. I have a script to name the new machines and add them, but I want to add into my login script a way to change the names of the existing computers to (%COMPUTERNAME% & "-OLD") if the computername is found in a list of computernames provided by a text file.

My mission for this is so that I can remove the old systems after deployment is done. My logon script is currently a vb script and the domain computers are a mix of Windows 2000 and Windows XP Pro.

Any help would be great!! The script would be better :-)
Thanks
0
Comment
Question by:TGignac
  • 2
5 Comments
 
LVL 10

Accepted Solution

by:
fostejo earned 250 total points
ID: 17085808
TGignac,

Have a look at WSName.exe available at http://mystuff.clarke.co.nz/wsname.asp - its datafile mode allows you to name computers based upon a variety of attributes.

For instance, if your datafile (PCNames.txt) contains the following:

PC1 = PC1.OLD
PC2 = PC2.OLD
LAPTOP1 = LAPTOP1.OLD

you could call the following command to rename the appropriate computers via the login script:  wsname  /RDF:"PCNames.txt" /DFK:$CURRENTNAME

Hope that helps..
0
 
LVL 1

Author Comment

by:TGignac
ID: 17086505
thanks fostejo... what a find... my command didn't seem to work for me though...

Because the machines are on a domain I have to ensure that they don't get removed from it when the name changes... and have to be able to add them back to the domain when done.

this is the exact command left out minus the secure info you don't need:

Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
wshShell.Run "wsname /RDF:pcnames.txt /DFK:$CURRENTNAME /RCID /USER:<mydomain>\administrator /pass:<password>", TRUE

I have both files, pcnames.txt and wsname.exe in the <SERVER>\NETLOGON folder.

pcnames.txt looks identicle to your example except I used a -old as opposed to .old

Any ideas?
0
 
LVL 1

Author Comment

by:TGignac
ID: 17087992

After looking even further, I found this in the wsname.Log

7/12/2006 1:38:50 AM : Call to Rename Computer in Domain returned error 1219 (session credential conflict)
7/12/2006 1:38:50 AM : You have an exisitng connection to the server with a different username
7/12/2006 1:38:50 AM : Rename Failed
7/12/2006 1:38:50 AM : Terminate                 : Exit code 6

0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

772 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