New
#1
Script to disable/enable a user
Hi,
I need a script/batch file that I can click to quickly
enable/disable a user.
How can I do this?
Hi,
I need a script/batch file that I can click to quickly
enable/disable a user.
How can I do this?
A one-liner bat file can do that pretty easy. This will do the trick:
To enable a user:
To disable it:Code:net user username /active:yes
Where username is the username to enable/disable.Code:net user username /active:no
This requires administrator permission to succeed.
Some reference can be found here:
Enable or Disable user account from command line (CMD)
yeah i saw that command when i did a google search previously.
It works but only when I run the command inside a command prompt
or calling the batch file in the command prompt.
It doesn't work when I doubt click the batch file.
Can u upload a batch file that allows me to doubt click and run it in explorer?
That line is the whole bat file required to do it, there isn't anything more to it. It works the very same way in the command prompt or in a bat file or in any other way you invoke it.
Remember you must be administrator for it to succeed. Otherwise you'll be greeted by an access denied error. Of course you must run the bat file as administrator, in the very same way you likely did at the command prompt.