Create Local User and add to local admin group
Posted: 13 Oct 2021 04:31
Hi all,
I am new to creating Bat scripts and I am trying to do something very simple which does not seem to be working.
I am simply trying to create a new local user and add them to the local Administrators group. I am also trying to set the password to never expire.
Below is my code :
net user ADMIN2 ******* /add /active:yes
wmic useraccount WHERE Name='ADMIN2' set PasswordExpires=false
net localgroup Administrators ADMIN2 /add
My code performs the first two lines, but does not add the the user to the local administrators group.
This is probably something very simple.
Thanks for the help in advance
I am new to creating Bat scripts and I am trying to do something very simple which does not seem to be working.
I am simply trying to create a new local user and add them to the local Administrators group. I am also trying to set the password to never expire.
Below is my code :
net user ADMIN2 ******* /add /active:yes
wmic useraccount WHERE Name='ADMIN2' set PasswordExpires=false
net localgroup Administrators ADMIN2 /add
My code performs the first two lines, but does not add the the user to the local administrators group.
This is probably something very simple.
Thanks for the help in advance