Link to home
Start Free TrialLog in
Avatar of bsharath
bsharathFlag for India

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of Farhan Kazi
Farhan Kazi
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bsharath

ASKER

In the file the machine names have to be like?
OldName:NewName
OldName1:NewName1
OldName2:NewName2
OldName3:NewName3
                ^------------------- Colon separated
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
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)