Sunday, January 22, 2012

Creating account in windowos command promt

For xp use:
@ECHO off
TITLE
AdminAccountCreator651juan@cw
COLOR
0f
set AC_PART=001
:HEADER
echo
.
ECHO
[INFO]
ECHO
[-]Create a hidden user acount U:%AC_NAME%;:%AC_PASS%; G:%AC_GROUP%; H:%AC_HIDE%
echo

GOTO
%AC_PART%

:001
SET
/P AC_NAME=[*]Account name?:
cls
SET AC_PART
=002
GOTO HEADER

:002
SET
/P AC_PASS=[*]Account password?:
cls
SET AC_PART
=003
GOTO HEADER

:003
SET
/P AC_COMMENT=[*]AccountComment?:
cls
SET AC_PART
=004
GOTO HEADER

:004
ECHO
[*The following groups are available on the machine.
ECHO
.
net localgroup
| find "*"
ECHO
.
SET
/P AC_GROUP=[*]Group?:
cls
SET AC_PART
=005
GOTO HEADER

:005
SET
/P AC_OK=[*]Creating acount now,Continue?y/:
IF NOT
%AC_OK%==y GOTO 0051
net user
%AC_NAME%%AC_PASS%/add /COMMENT:"%AC_COMMENT%"
net localgroup
"%AC_GROUP%"%AC_NAME%/add
ECHO.
pause

:0051
cls
SET AC_PART=006
GOTO HEADER

:006
SET /
P AC_HIDE=[*]Do you want to hide the account from the XP logon screen?y/:
IF NOT
%AC_HIDE%==y GOTO END
echo
WindowsRegistryEditorVersion5.00>%TEMP%’addregistry.reg
echo
[HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows

NT
CurrentVersionWinlogonSpecialAccountsUserList]>>%TEMP%’addregistry.reg
echo
"%AC_NAME%"=dword:00000000>>%TEMP%’addregistry.reg
Regedit/%TEMP%’addregistry.reg
Del%TEMP%’addregistry.reg
:END
ECHO
.
pause

For win 7 use:
net user /add useraccountname mypassword

net localgroup administrators useraccountname
/add

net share concfg
*C:’/grant:useraccountname,full

net user useraccountname
*

This will create an administrator account called useraccountname with a password of mypassword. The account can be created without a password as well.

If you need to delete the account use the same code as mentioned in line 1, but insert ’delete’ where ’add’ was used.

Administrator privileges may be needed.. look for my other post on how to get these.