≡ Menu

How to remove user login password from command prompt

For Windows home users, having a login password is not absolutely necessary if the physical access to the device is restricted. Also, anyone running automated tests with login, you may want to enable login automatically without being prompted for a password. Learn how to remove user password for a local user from windows command prompt.

Remove user account password from command prompt

Net user does not support much password related operations. So we use WMIC command for this purpose.

wmic useraccount where name='loginId' set PasswordRequired=false

Before removing password

c:\>net user test1 | findstr "Password"
Password last set            5/8/2019 8:02:07 PM
Password expires             8/6/2019 8:02:07 PM
Password changeable          5/8/2019 8:02:07 PM
Password required            Yes

Now run the command to remove password

c:\>wmic useraccount where name='test1' set PasswordRequired=false

Now check using ‘net user’ again

c:\>net user test1 | findstr "Password"
Password last set            5/8/2019 8:04:12 PM
Password expires             8/6/2019 8:04:12 PM
Password changeable          5/8/2019 8:04:12 PM
Password required            No

Note that the WMIC command to remove password should be run run from elevated administrator command prompt. From a normal command prompt, it throws the below error.

C:\>wmic useraccount where name='test1' set PasswordRequired=false
Updating property(s) of '\\MYPC\ROOT\CIMV2:Win32_UserAccount.Domain="MYPC",Name="test1"'
Description = Generic failure

Remove password for all user accounts

This can be done with a slight change to the command shown previously. Just remove the ‘where’ clause and it should update it for all users on the computer.

wmic useraccount set PasswordRequired=false

How to enable back the password

wmic useraccount where name='test1' set PasswordRequired=true
3 comments… add one
  • Spoiledpeanuts

    Hello, Thank you for sharing this. helps a lot!

  • Ain

    Any help to undo this command line? Somebody used it to lock me out of my comp. Or something like it, not really sure. When I try to reboot, the command prompt shows a “no optin” code.
    Please help a harassed user to get to my work!

  • Harry

    Need to delete forgotten admin password. Command prompt not accessible without admin password.

Leave a Comment