Solved

Disabling Accounts via Command Line

Posted on 2004-09-28
5
287 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
ID: 12168333
0
 
LVL 57

Assisted Solution

by:Pete Long
Pete Long earned 50 total points
ID: 12168380
example

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

Author Comment

by:stewatts
ID: 12168398
How would I do this with the following user:

username testuser
domain itdom-tr

Many thanks
0
 
LVL 10

Expert Comment

by:Longbow
ID: 12168676
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
ID: 12168682
The script will open an inputbox to allow you to enter a username
0

Featured Post

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Task scheduler to manage event fails 4 735
How to NTBackup if SQL Server running? 6 893
Locking down a taskpad 1 151
Running Baan iV on VMware 3 117
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 aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

920 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

15 Experts available now in Live!

Get 1:1 Help Now