Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: Script to disable/enable a user

16 Jun 2016   #1
madmax2

Microsoft Windows 7 Ultimate 64-bit 7601 Multiprocessor Free Service Pack 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?


My System SpecsSystem Spec
.
16 Jun 2016   #2
Alejandro85

Windows 7 Ultimate x64
 
 

A one-liner bat file can do that pretty easy. This will do the trick:

To enable a user:
Code:
net user username /active:yes
To disable it:
Code:
net user username /active:no
Where username is the username to enable/disable.
This requires administrator permission to succeed.

Some reference can be found here:
Enable or Disable user account from command line (CMD)
My System SpecsSystem Spec
17 Jun 2016   #3
madmax2

Microsoft Windows 7 Ultimate 64-bit 7601 Multiprocessor Free Service Pack 1
 
 

Quote   Quote: Originally Posted by Alejandro85 View Post
A one-liner bat file can do that pretty easy. This will do the trick:

To enable a user:
Code:
net user username /active:yes
To disable it:
Code:
net user username /active:no
Where username is the username to enable/disable.
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?
My System SpecsSystem Spec
.

17 Jun 2016   #4
Alejandro85

Windows 7 Ultimate x64
 
 

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.
My System SpecsSystem Spec
Reply

 Script to disable/enable a user




Thread Tools Search this Thread
Search this Thread:

Advanced Search




Similar help and support threads
Thread Forum
Disable LAN connection for specific user/enable wireless only
Hi all, I'm setting up a computer for public access to a local site (repository). There are two accounts: 1.admin account: running a virtual machine as server for the local site. I need access to LAN through wired ethernet in this account 2.public account: the account for the users to...
Network & Sharing
Disable/Enable USB Devices in Windows Manager With Script
My scenario is as is... We have a ton of companies running windows 2008 (HP ML110G8) servers. These servers have zebra label printers installed on them. We have noticed that these printers will lock up and stop printing until the end user unplugs the device and plugs it back into the computer....
Hardware & Devices
Script to Disable Touchpad?
I have a Lenovo G570 notebook that I love except for one little detail. I hate, loathe, detest, and just don't like touchpads and there is no way to permanently turn the stupid thing off on this machine. I can turn it off after booting by hitting FN/F6 but, of course, I never remember to do so...
Hardware & Devices
User Account - Enable or Disable
How to Enable or Disable a User Account in Windows 7 and Windows 8 This tutorial will show you how to enable (unlock) or disable (lock) a domain, local, or Microsoft user account in Windows 7 and Windows 8. You must be logged in as an administrator to be able to do the steps in this...
Tutorials
script for W7 / to enable rdp and from older client
Is there a script to enable rdp on w7 machines and also to allow older os's like wxp to rdp to w7 machines? thanks
Network & Sharing
Backup User and System Data Files - Enable or Disable
How to Enable or Disable to Backup Data Files in Windows 7 This will allow you to enable or disable the ability of all users on the computer to Backup User and System Data Files in Windows 7. This is enabled by default in Windows 7. EXAMPLE: When Backup is Disabled Messages Using a...
Tutorials


Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 03:43.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App