S
S
Sayonara232021-01-21 14:31:16
cmd/bat
Sayonara23, 2021-01-21 14:31:16

How to add a local user to the Administrators group via cmd?

Good afternoon. There was a need to add a local user to many computers, so that in the event of a network failure and the inability to log in under a domain account, it would be possible to log in under a local one. You need to add a user remotely via cmd.

net user %username% %pass% /addadds an account, but by default it is in the "Users" group, but it needs to be in the "Administrators" group.
net localgroup Администраторы %username% /addadds a domain account, but a local one is required.

What can be done?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2021-01-21
@Sayonara23

Well, specify a local account instead of% username%.

C
CityCat4, 2021-01-21
@CityCat4

Use group policies - they are designed for this. And adding an admin through a batch file is an expanse for mom's hackers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question