Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 294
  • Last Modified:

Disabling Accounts via Command Line

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
stewatts
Asked:
stewatts
  • 2
  • 2
2 Solutions
 
Pete LongTechnical ConsultantCommented:
example

dsmod CN=username,DC=domainname,DC=com -disabled yes
0
 
stewattsAuthor Commented:
How would I do this with the following user:

username testuser
domain itdom-tr

Many thanks
0
 
LongbowCommented:
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
 
LongbowCommented:
The script will open an inputbox to allow you to enter a username
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now