Enable or Disable a user account from command prompt

Posted on .

In a domain environment you can enforce logon times for individual users, I wanted to emulate this behaviour in a workgroup.

To do this first I learnt the following commands in command prompt [cmd] (run as Administrator):

To disable: net user Bob /active:no
To enable: net user Bob /active:yes

I then created 2 tasks in Task Scheduler to disable and enable at the appropriate times.

When creating the tasks its important to note:

  • Run with highest privileges
  • Run even when user not logged on
  • The path to the “net” command is “C:\Windows\System32\net.exe”
  • The rest of the command line goes in the arguments box

This helped to discourage my son from waking up at 4am to play Plants vs Zombies™ on the computer.

Leave a Reply

You may leave the Name and Email fields blank to post anonymously.