Solved

Disabling Accounts via Command Line

Posted on 2004-09-28
5
284 Views
Last Modified: 2010-08-05
Hi

Does anyone know of a tool and the syntax to disable a user account in Active Directory form the command line?

Thanks

Ste
0
Comment
Question by:stewatts
  • 2
  • 2
5 Comments
 
LVL 57

Accepted Solution

by:
Pete Long earned 50 total points
Comment Utility
0
 
LVL 57

Assisted Solution

by:Pete Long
Pete Long earned 50 total points
Comment Utility
example

dsmod CN=username,DC=domainname,DC=com -disabled yes
0
 

Author Comment

by:stewatts
Comment Utility
How would I do this with the following user:

username testuser
domain itdom-tr

Many thanks
0
 
LVL 10

Expert Comment

by:Longbow
Comment Utility
You van use notepad and put the next script in then save it as .vbs.
Change "computername" with the computername of your server.
I don't have tried. No server 2000 here now :

'--- Disable account ADSI script ---
Set WSHShell = WScript.CreateObject("WScript.Shell")
UName = InputBox("Disable account","Username to disable : ")

Set UserObj = GetObject("WinNT://ComputerName/" & UName)
UserObj.AccountDisabled = True
UserObj.SetInfo
Set UserObj = Nothing
'--- End Disable account ---
0
 
LVL 10

Expert Comment

by:Longbow
Comment Utility
The script will open an inputbox to allow you to enter a username
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
This article explains in simple steps how to renew expiring Exchange Server Internal Transport Certificate.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now