≡ Menu

Enable or Disable user account from command line (CMD)

To disable a user from logging into system, we can disable the account by opening computer management console and double clicking on the entry for the user and then by selecting the check button “Account is disabled

We can do the same by just running a simple command from windows command line.

For example, to disable a user account named John we can run the below command.

Net user John /active:no

To re-enable the account :

Net user John /active:yes

In Windows 7, you need to run the above commands from elevated administrator command prompt(See How to open elevated command prompt in Windows 7 ). You would get the below error when you run them from normal command prompt.

System error 5 has occurred.
Access is denied.

Using wmic to disable user account

Below wmic command works for disabling a user account

wmic useraccount where name='john' set disabled=true

For re-enabling user account

wmic useraccount where name='john' set disabled=false

If run from command prompt without elevated admin privileges it would result in the below error.

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

Successful account updation would be like below.

C:\>wmic useraccount where name='john' set disabled=false
Updating property(s) of '\\MYPC\ROOT\CIMV2:Win32_UserAccount.Domain="MYPC",Name="john"'
Property(s) update successful.

Related Posts:
Remove user from a group

14 comments… add one
  • Ananamous

    This was really helpful! thanks

  • Dodi

    I’m so very thanks cause my notebook was success enabled account

  • Anonymoose

    Hey; this guide was very helpful, but is it possible to lock a user account while using it? For example, I am using my administrator account and I don’t need it anymore. Can I lock it using command prompt, or do I need to use another user account? If I can do that, what happens? Will the account instantly close, or will I have to restart to see changes?
    Thanks

  • Shahid shaik

    Is there any way to enable atleast one user account if all user accounts are disabled including administrator.

  • DeathFromAbove

    If you know the administrator password you can do this from any account.

  • Bart

    Many thanks,

    this way I was able to overcome restrictions imposed on Windows 8.1 Home (or whatever the basic version is) No access to Users and groups in Admin tools, yet the above is working.

  • daniel

    Ive made all the accounts disable !! Even the administrator … and I’m not able to get into the windows in order to change it … any help would be appreciated

    • Christian

      Daniel,
      Why would you do that?

    • Srini

      I think you should just redeploy Windows on your system

  • Steve

    Useless completely ! Why ??? CCE has tamper with UAC and locked me off of my administrative access rights in my Admin account and i have no access at all to change something !!! And this is only possible with MS under Linux no such thing !!! MS has invented access rights where only one administrative access can be locked out and newer again unlocked due no administrative access possible any more ! Format and installing it again is the only repair possible under such circumstances !!! Stupid MS credentials audit and administrative access results in self contained crippling system to the point of no use !!! One don’t need a virus MS it self is self crippled OS ! This one is shoot into the knee by them self and on my nerves !!! Its like being locked out of your car with the keys in it ! Very nice direct comparison ! Solve that !!! This is why i hate MS more and more – making huge troubles where troubles can be avoided ! What the hell they code ???

  • RideMan

    If you have a second computer or someone that can help, download a Linux live CD (many flavors out there) to boot your PC. You may be able to setup a new Admin account without having to even log onto Windows.
    http://www.howtogeek.com/howto/14369/change-or-reset-windows-password-from-a-ubuntu-live-cd/

  • khalil

    how can i disable/enable the current user without know what’s his name
    Is there ‘Current user’or any thing like that
    please help me

    • Clockwork

      Just type ‘net users’ into cmd, then look for the account with the name you don’t know… then type “net user ‘the account name’ /active:yes or no”

  • chris

    this was SUPER helpful THANKS

Leave a Comment