Home All Groups Group Topic Archive Search About

Scripting, Local Admin Account

Author
24 Mar 2009 1:34 PM
ScriptNewBe
I am new to scripting and I am trying to create a script that will create a local admin account on 50 machines running windows xp, that are all in a domain. I would just like to set a general account name, and pull the password for a txt file that is saved on that machine.

What would be the best way to perform this task? -- ScriptNewBe ------------------------------------------------------------------------ ScriptNewBe's Profile: http://forums.techarena.in/members/84626.htm View this thread: http://forums.techarena.in/server-scripting/1146961.htmhttp://forums.techarena.in

Author
24 Mar 2009 2:37 PM
Pegasus [MVP]
"ScriptNewBe" <ScriptNewBe.3pk3jb@DoNotSpam.com> wrote in message
news:ScriptNewBe.3pk3jb@DoNotSpam.com...
>
> I am new to scripting and I am trying to create a script that will
> create a local admin account on 50 machines running windows xp, that are
> all in a domain. I would just like to set a general account name, and
> pull the password for a txt file that is saved on that machine.
>
> What would be the best way to perform this task?

It depends what you mean by "best way". Shortest script? Dependent on native
tools only? Easy to understand for a novice?

You could use psexec.exe (www.sysinternals.com) to invoke the following
batch file, which you should store in a central location:

@echo off
set PWFile=c:\AdminPW.txt
if not exist %PWFile% goto :eof
for /F %%a in (%PWFile%) do set PW=%%a
echo net user NewAdmin %PW% /add
echo net localgroup Administrators NewAdmin /add

Note that storing a local admin's password in a file on the local machine
creates an obvious security issue. Much better to store it in a central and
protected folder.
Author
24 Mar 2009 5:33 PM
ScriptNewBe
I would like to use the shortest script and easiest to maintain.  Yes, I know that would be a security risk, I was just using it as a reference of idea.  It will be protected.  :) 

I will try it out and see how it goes.  Thank you. -- ScriptNewBe ------------------------------------------------------------------------ ScriptNewBe's Profile: http://forums.techarena.in/members/84626.htm View this thread: http://forums.techarena.in/server-scripting/1146961.htmhttp://forums.techarena.in
Author
24 Mar 2009 11:44 PM
Al Dunbar
"ScriptNewBe" <ScriptNewBe.3pk3jb@DoNotSpam.com> wrote in message
news:ScriptNewBe.3pk3jb@DoNotSpam.com...
>
> I am new to scripting and I am trying to create a script that will
> create a local admin account on 50 machines running windows xp, that are
> all in a domain. I would just like to set a general account name, and
> pull the password for a txt file that is saved on that machine.
>
> What would be the best way to perform this task?

I'd recommend against doing it at all. Given the domain, it would be more
manageable and more secure to add AD groups to the local "administrators"
group on each machine.

/Al

Show quoteHide quote
>
>
> --
> ScriptNewBe
> ------------------------------------------------------------------------
> ScriptNewBe's Profile: http://forums.techarena.in/members/84626.htm
> View this thread: http://forums.techarena.in/server-scripting/1146961.htm
>
> http://forums.techarena.in
>