How to add user to a “User” localgroup in Windows 7.

@echo off

rem ——————————————————————————
rem adding ‘webserverpage’ account and adding to the Users group
rem ——————————————————————————

rem — Displaying Batch Filename —
echo “Now executing %~f0 … ”
echo.
echo.
echo.
rem ———————————

net user webserverpage password /add /y
net user webserverpage password /ACTIVE:YES /EXPIRES:NEVER /PASSWORDCHG:NO /PASSWORDREQ:YES
net localgroup users webserverpage /add /y

rem — /EXPIRES:NEVER Line doesn’t work , added the line below for this to work —

WMIC USERACCOUNT WHERE “Name=’webserverpage'” SET PasswordExpires=FALSE

Leave a Reply