I built a batch script to create a local user and add it to the local administrators group. The script requires two arguments – one is the user’s login name, another is the user’s full name. The user’s password is hard-coded, but it can be changed to an argument with a small modification.
@echo off
set PASSWORD=XXXXXXXXXREM add a local user with password
net user %1 %PASSWORD% /add /fullname:%2
REM add a local user to the administrators group
net localgroup administrators %1 /add
One thing I learned is that not all options (e.g. /fullname) are showed when typing “net user /?”. For more other options, see this Technet document.
No comments:
Post a Comment