Need to know if this is possible

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
sxekjb
Posts: 16
Joined: 07 Nov 2009 19:13

Need to know if this is possible

#1 Post by sxekjb » 09 Nov 2009 14:53

I need to rename quite a lot of machines over the domain. Right now I'm doing this using the netdom command

Code: Select all

netdom renamecomputer mycomputer /newname:new_name /ud:domain\user /pd:password


-I'm having to go through this step every time. I'm wondering if there's a way to create a batch that will automatically fill in the old and new computer name possibly from a list, and if possible maybe perform the same task for an entire list of machines over the network.

Thank you :)

sxekjb
Posts: 16
Joined: 07 Nov 2009 19:13

#2 Post by sxekjb » 12 Nov 2009 08:33

Figured it out.

Created notepad list of names with the old name as token=1 and new as token=2

Then:

Code: Select all

FOR /f "tokens=1,2 delims= " %%G IN (names.txt) DO netdom renamecomputer %%G /newname:%%H /userD:domain\username /passwordD:password /userO:domain\username /passwordO:password

Post Reply