Categories: User Accounts

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

Example:
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"'
ERROR:
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
Srini

View Comments

  • Hi,
    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!

Share
Published by
Srini

Recent Posts

Add new user account from command line (CMD)

Adding users from command line is much easier than going through the UI. It saves…

4 years ago

Delete directory from command line [Rmdir]

Do you want to delete a directory from Windows command prompt(CMD)? This post explains how…

4 years ago

TaskKill: Kill process from command line (CMD)

We can kill a process from GUI using Task manager. If you want to do…

4 years ago

Kill Chrome from command line

Chrome is definitely the stable browser compared to other ones and it has been my…

4 years ago

Find windows OS version from command line

Windows has multiple command line utilities that can help find the version of the Windows…

4 years ago

How to check if Windows 32 or 64 bit?

There are multiple ways to check whether a Windows computer is running 32-bit OS or…

7 years ago