Batch File To Add User To Local Admin Group - LOCAAKJ
Skip to content Skip to sidebar Skip to footer

Batch File To Add User To Local Admin Group

Batch File To Add User To Local Admin Group. If you do a runas then the script will add the account that is doing the runas to the administrators group. In the example below, i’ll add my user david azure (davida) to the local administrators group on two server (win27, win28)

Incorporating Custom Scripts in BatchPatch Get Local Administrators
Incorporating Custom Scripts in BatchPatch Get Local Administrators from batchpatch.com

Basic batch file to create a local user and then add it to the local admin group. Net localgroup administrators [username] /add. Here is one command in a batch file that will add all the users from a.csv file.

For Example If You Would Have It On A Server's Mapped Drive It Would Not Work.


If the account is in groups under groups folder in local users and groups, select groups. Add that group to the target computer’s local admin group. Here we have used usermod to add the user to an existing group, these groups will be supplementary groups for the user.

C:\>Net Localgroup Administrators Billybob /Add.


The script will create a local user and add them to the administrators group on the client machine. Net localgroup remote desktop users userloginname /add. Create one security group for each target computer.

I Still Need To Open The Windows Powershell Console Or Ise With Admin Rights, But This Time The Connection Is A Bit More Complicated.


This way since every computer has its own unique security group, you don’t end up giving one user access to another user’s computer. Right click on the right panel and select add group. Net user “user1” “pa$$w0rd” /add net user “user2” “pa$$w0rd” /add net user “user3” “pa$$w0rd” /add echo “adding users to admin group” net localgroup administrators user1 /add net localgroup administrators user2 /add

(You Can Use Restricted Groups Via Gpo, Which Adds Members To The Local Admins Group While At The Same Time Removing Members Who Shouldn't Be There.) If This Computer Is Not Part Of A Domain, Just Run.


Local users and groups is only available in the windows 10 pro, enterprise, and education editions. Connect to the actual group. If the computer is joined to a.

Here Are The Steps To Add Local Administrators Via Gpo.


If adminx does not exist go create local adminx, add adminx to administrators. You could of course also run the above line in a batch file. Adding a user to a group is a bit different than creating a local user or a local group.

Post a Comment for "Batch File To Add User To Local Admin Group"