Thursday, October 11, 2012

Add local admin from command line

net user AdminNWS password /add
net localgroup Administrators AdminNWS /add
wmic useraccount where "name='AdminNWS'" set PasswordExpires=false
net user AdminNWS *

These commands create a new user AdminNWS with password "password", add it to the local Administrators group, and then uses WMIC to set the password to never expire. The last line prompts you for a new password for the ID.

On Win7+ you can also take steps to hide the account from the logon screen:


REG.EXE ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList" /V AdminNWS /t REG_DWORD /d 0
(line splits)

No comments:

Post a Comment