Search This Blog

Batch Script for Creating An User and Adding to Member of Local Administrators Group

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=XXXXXXXXX

REM 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

Use WinSCP to Transfer Files in vCSA 6.7

This is a quick update on my previous post “ Use WinSCP to Transfer Files in vCSA 6.5 ”. When I try the same SFTP server setting in vCSA 6.7...