Add a user to Local Admin group on All machines.

Scenario: You need to add a user (test1) to local
Administrators group on all computer. How do you achieve this??? no no…you’re
wrong here – don’t need to use VBScript or something like that simply use
PSEXEC to accomplish this! – intersting!

Here it is:

psexec.exe net localgroup administrators
test.local\test /add
-@server.txt

Isn’t simple as pie?

-@server.txt – This
file includes the list of servers to be processed by psexec to run the Net
Localgroup Administrators test.local\test /add
command.

net localgroup – This command directs NBT API to execute a
command using Windows Low-level sub-system. You should use Net Group for Global
security group if you’re gonna add to Global Security Group.

[H]

7 thoughts on “Add a user to Local Admin group on All machines.”

  1. Hi
    I tried your posting but had to use the syntax

    psexec.exe @server.txt net localgroup administrators /add

    as having tried the original syntax, I got a warning “There is no such global user or group: @server.txt”.

    However my version of the syntax also fails with “Access Denied” for every server listed in server.txt. Do you have any idea, why this would be so?

    Many thanks – Colin

  2. Access Denied can be due to a handful of things. I usually see this when I run this kind of command against a remote machine while using an account that’s not already an administrator on that machine.

    Or:
    You need to be an administrator on the remote machine to add other folks to the local administrator group.

Leave a Reply to Colin Kemp Cancel reply

Your email address will not be published. Required fields are marked *