need help with a batch file adding users

  • Thread starter Thread starter Tester
  • Start date Start date
T

Tester

I want to add a user (the same one) to all of my systems as a local admin.
I am preparing an upgrade to sbs2003 and I want to create a backdoor on all
systems in case they don't convert so I can still log in. Then reverse the
process once they are done.

I figure I can use
something like this for loop to do it and a tool or two from the reskit.
Can the for loop process multiple commands? if so, how
FOR /L %%1 IN (1,1,254) DO ping -a 192.168.1.%%1 -n 1


any thoughts?
thanks
 
Tester said:
I want to add a user (the same one) to all of my systems as a local
admin. I am preparing an upgrade to sbs2003 and I want to create a
backdoor on all systems in case they don't convert so I can still log
in. Then reverse the process once they are done.

I figure I can use something like this for loop to do it and a tool
or two from the reskit. Can the for loop process multiple commands?
if so, how FOR /L %%1 IN (1,1,254) DO ping -a 192.168.1.%%1 -n 1

Hi,

For part 1) of your question, you could generate a list of machines and
use cusrmgr.exe from the Windows 2000 Resource Kit to add them to the
domain:

@echo off
for /f %%c in ('type Computers.txt') do (
cusrmgr -m %%c -u yourusername -alg Administrators
)

Or something similar.

For part 2), yes, the for iterator command can process multiple commands.

HTH,

Bill
 
For uses %%<CASE SENSITIVE LETTER> (on older NT it's not case sensitive so 52 v's 26 possible For variables)

Parameters to batch files use %<NUMBER>
 
SBS will join them to the domain, I want to add a local admin by pasing the
current domain admin user and login,

So how do I seperate the multiple commands on the for statement? semicolon?
 
Tester said:
SBS will join them to the domain, I want to add a local admin by
pasing the current domain admin user and login,

I don't follow you here. If you are logging on interactively to each
machine, you can go to a command prompt and type:

net localgroup administrators domain\username /add
So how do I seperate the multiple commands on the for statement?
semicolon?

By using the command separator character (&) or by enclosing multiple
commands in parentheses and separating them with separators or returns.
See help for the command prompt for more information.

Bill
 
ok the & character. good.

I am migrating to small bus. server 2003 from a 2000 network
during the migration it will convert machines and move them to the new
domain and the old one will be gone, so I won't be able to authenticate to
the old domain. I just want to make sure I have a backdoor on all of them
first as a local admin. Call it paranoia, but at least I will be able to
log in and rejoin the new domain or what ever I need to do.

Probably unnecessary, but a challenge none the less. should be fun. thanks
 
Back
Top