Creating local user and adding it to power user group on some ser

G

Guest

I need to create a local user with a password and add them to the local power
users group, does anyone have a script to do that? Thanks again for your
help...
 
P

Pegasus \(MVP\)

KJ said:
I need to create a local user with a password and add them to the local power
users group, does anyone have a script to do that? Thanks again for your
help...

From the help text in generated by typing net user /?:
The syntax of this command is:
NET USER
[username [password | *] [options]] [/DOMAIN]
username {password | *} /ADD [options] [/DOMAIN]
username [/DELETE] [/DOMAIN]

From the help text generated by typing net localgroup /?:
The syntax of this command is:
NET LOCALGROUP
[groupname [/COMMENT:"text"]] [/DOMAIN]
groupname {/ADD [/COMMENT:"text"] | /DELETE} [/DOMAIN]
groupname name [...] {/ADD | /DELETE} [/DOMAIN]

Hence:
net user JSmith SomePassword /add
net localgroup "Power Users" JSmith /add
 
G

Guest

Thanks for the response...
I have about 100 servers and I want to create a new local user and add them
to the power users group with a script. So, I would have a text file with
the name of all the servers that I want to have a user created and add them
to the power users group. I am really looking for a script to do this...
Thanks
Kee

Pegasus (MVP) said:
KJ said:
I need to create a local user with a password and add them to the local power
users group, does anyone have a script to do that? Thanks again for your
help...

From the help text in generated by typing net user /?:
The syntax of this command is:
NET USER
[username [password | *] [options]] [/DOMAIN]
username {password | *} /ADD [options] [/DOMAIN]
username [/DELETE] [/DOMAIN]

From the help text generated by typing net localgroup /?:
The syntax of this command is:
NET LOCALGROUP
[groupname [/COMMENT:"text"]] [/DOMAIN]
groupname {/ADD [/COMMENT:"text"] | /DELETE} [/DOMAIN]
groupname name [...] {/ADD | /DELETE} [/DOMAIN]

Hence:
net user JSmith SomePassword /add
net localgroup "Power Users" JSmith /add
 
P

Pegasus \(MVP\)

You could do this:

@echo off
for /F %%a in (c:\Servers.txt) do psexec.exe \\%%a
\\YourServer\SomeShare\AddUser.bat

AddUser.bat is the two-line batch file I suggested in my first reply.
psexec.exe is freely downloadable from www.sysinternals.com.


KJ said:
Thanks for the response...
I have about 100 servers and I want to create a new local user and add them
to the power users group with a script. So, I would have a text file with
the name of all the servers that I want to have a user created and add them
to the power users group. I am really looking for a script to do this...
Thanks
Kee

Pegasus (MVP) said:
KJ said:
I need to create a local user with a password and add them to the
local
power
users group, does anyone have a script to do that? Thanks again for your
help...

From the help text in generated by typing net user /?:
The syntax of this command is:
NET USER
[username [password | *] [options]] [/DOMAIN]
username {password | *} /ADD [options] [/DOMAIN]
username [/DELETE] [/DOMAIN]

From the help text generated by typing net localgroup /?:
The syntax of this command is:
NET LOCALGROUP
[groupname [/COMMENT:"text"]] [/DOMAIN]
groupname {/ADD [/COMMENT:"text"] | /DELETE} [/DOMAIN]
groupname name [...] {/ADD | /DELETE} [/DOMAIN]

Hence:
net user JSmith SomePassword /add
net localgroup "Power Users" JSmith /add
 
G

Guest

Pegasus
I was running it this way, without the network share...
psexec @c:\temp\computerslist.txt -u rspa\leek -p Pa33word -c
c:\temp\adduser.bat -d

and it seems to run fine for several workstations in HQ but remote
workstations I am having a hard time, I'll keep you posted...
But I really do appreciate your posts, now I know you can use variables
instead of @path:\textfileofservers...This should work as well, correct?
thanks again


Pegasus (MVP) said:
You could do this:

@echo off
for /F %%a in (c:\Servers.txt) do psexec.exe \\%%a
\\YourServer\SomeShare\AddUser.bat

AddUser.bat is the two-line batch file I suggested in my first reply.
psexec.exe is freely downloadable from www.sysinternals.com.


KJ said:
Thanks for the response...
I have about 100 servers and I want to create a new local user and add them
to the power users group with a script. So, I would have a text file with
the name of all the servers that I want to have a user created and add them
to the power users group. I am really looking for a script to do this...
Thanks
Kee

Pegasus (MVP) said:
I need to create a local user with a password and add them to the local
power
users group, does anyone have a script to do that? Thanks again for your
help...

From the help text in generated by typing net user /?:
The syntax of this command is:
NET USER
[username [password | *] [options]] [/DOMAIN]
username {password | *} /ADD [options] [/DOMAIN]
username [/DELETE] [/DOMAIN]

From the help text generated by typing net localgroup /?:
The syntax of this command is:
NET LOCALGROUP
[groupname [/COMMENT:"text"]] [/DOMAIN]
groupname {/ADD [/COMMENT:"text"] | /DELETE} [/DOMAIN]
groupname name [...] {/ADD | /DELETE} [/DOMAIN]

Hence:
net user JSmith SomePassword /add
net localgroup "Power Users" JSmith /add
 
P

Pegasus \(MVP\)

I am not aware of the @ option with psexec.exe. I run version 1.31.


KJ said:
Pegasus
I was running it this way, without the network share...
psexec @c:\temp\computerslist.txt -u rspa\leek -p Pa33word -c
c:\temp\adduser.bat -d

and it seems to run fine for several workstations in HQ but remote
workstations I am having a hard time, I'll keep you posted...
But I really do appreciate your posts, now I know you can use variables
instead of @path:\textfileofservers...This should work as well, correct?
thanks again


Pegasus (MVP) said:
You could do this:

@echo off
for /F %%a in (c:\Servers.txt) do psexec.exe \\%%a
\\YourServer\SomeShare\AddUser.bat

AddUser.bat is the two-line batch file I suggested in my first reply.
psexec.exe is freely downloadable from www.sysinternals.com.


KJ said:
Thanks for the response...
I have about 100 servers and I want to create a new local user and add them
to the power users group with a script. So, I would have a text file with
the name of all the servers that I want to have a user created and add them
to the power users group. I am really looking for a script to do this...
Thanks
Kee

:


I need to create a local user with a password and add them to the local
power
users group, does anyone have a script to do that? Thanks again
for
your
help...

From the help text in generated by typing net user /?:
The syntax of this command is:
NET USER
[username [password | *] [options]] [/DOMAIN]
username {password | *} /ADD [options] [/DOMAIN]
username [/DELETE] [/DOMAIN]

From the help text generated by typing net localgroup /?:
The syntax of this command is:
NET LOCALGROUP
[groupname [/COMMENT:"text"]] [/DOMAIN]
groupname {/ADD [/COMMENT:"text"] | /DELETE} [/DOMAIN]
groupname name [...] {/ADD | /DELETE} [/DOMAIN]

Hence:
net user JSmith SomePassword /add
net localgroup "Power Users" JSmith /add
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top