• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 309
  • Last Modified:

Rename a machine remotely

Hi,

I have this script.Which can rename a machine name in the computers.txt file to the name given in the script (Dev-chen-pc5000)

C:\>for /f "tokens=1,2" %x in (C:\computers.txt) do  netdom renamecomputer %x /n
ewname:dev-chen-pc5000 /userD:development\administrator /passwordd:password /reboot:10 /force
this is working perfectly for me.
What i want now is to do this for many systems at once.
Can i have a script to rename all the machines in the computers.txt
I have the content as
Oldname : Newname (Inthe txt file)
Can a script rename all the machines at once.

Regards
Sharath
0
bsharath
Asked:
bsharath
  • 4
  • 3
1 Solution
 
Farhan KaziSystems EngineerCommented:
Try this:
FOR /F "delims=: tokens=1-2" %a IN ('Type C:\Computers.txt') Do NetDom RenameComputer %a /newname:%b /userD:development\administrator /passwordd:password /reboot:10 /force
0
 
bsharathAuthor Commented:
In the file the machine names have to be like?
0
 
Farhan KaziSystems EngineerCommented:
OldName:NewName
OldName1:NewName1
OldName2:NewName2
OldName3:NewName3
                ^------------------- Colon separated
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
bsharathAuthor Commented:
I get this.

C:\>NetDom RenameComputer dev-chen-nas100 /newname:dev-chen-nas1000 /userD:devel
opment\administrator /passwordd:password /reboot:10 /force
The NetBIOS name of the computer is limited to 15 bytes. The NetBIOS name
will be shortened to "DEV-CHEN-NAS100".

The command completed successfully.

Will this have any problems
0
 
Farhan KaziSystems EngineerCommented:
All NetBIOS names are 16 characters in length. However Microsoft limits a NetBIOS name to be 15 characters in lenght and uses the 16th character as the NetBIOS suffix.
So 'dev-chen-nas1000' is an invalid name because it has 16 characters (it should have maximum 15 characters)
0
 
Farhan KaziSystems EngineerCommented:
Have a look at following:
http://support.microsoft.com/kb/909264
0
 
bsharathAuthor Commented:
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now