0% found this document useful (0 votes)
474 views

Enable or Disable User Account From Command Line

This document discusses how to disable and enable user accounts from the Windows command line or with WMIC commands. It provides the "Net user" command to disable an account with "/active:no" and enable it with "/active:yes". For WMIC, it shows using "wmic useraccount where name='account' set disabled=true/false" to disable or enable the account. Running the commands from an elevated administrator command prompt is required to avoid access denied errors.

Uploaded by

emil2809
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
474 views

Enable or Disable User Account From Command Line

This document discusses how to disable and enable user accounts from the Windows command line or with WMIC commands. It provides the "Net user" command to disable an account with "/active:no" and enable it with "/active:yes". For WMIC, it shows using "wmic useraccount where name='account' set disabled=true/false" to disable or enable the account. Running the commands from an elevated administrator command prompt is required to avoid access denied errors.

Uploaded by

emil2809
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Enable or Disable user account from

command line (CMD)


by Srini

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.

1
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.

You might also like