Solved

Disabling AD Accounts through scripting

Posted on 2011-03-22
3
391 Views
Last Modified: 2012-05-11
Does anyone have a script for just the disabling of accounts not to delete, so that i can run the script on users i need to disable instead of using ADUC?
0
Comment
Question by:arsenal22
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 70

Assisted Solution

by:KCTS
KCTS earned 166 total points
ID: 35194105
dsmod user "CN=John Smith,CN=Users,DC=MyDomain,DC=Com" -disabled yes
0
 
LVL 4

Accepted Solution

by:
philetaylor earned 167 total points
ID: 35194126
You can use the dsmod command:

dsmod user "CN=username, CN=User,DC=domain,DC=com" -disabled yes

http://technet.microsoft.com/en-us/library/cc732954(WS.10).aspx

Has full usage for this command.

Cheers

Phil
0
 
LVL 13

Assisted Solution

by:soostibi
soostibi earned 167 total points
ID: 35194266
PowerShell:

With Windows Server 2008 R2 ActiveDirectory module:
Get-ADUser samaccounname| Set-ADUser -Enabled $false

With Quest's ActiveRoles.ADManagement snapin:
Get-QADUser samaccounname | Disable-QADUser
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

This article demonstrates probably the easiest way to configure domain-wide tier isolation within Active Directory. If you do not know tier isolation read https://technet.microsoft.com/en-us/windows-server-docs/security/securing-privileged-access/s…
In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
This video demonstrates how to sync Microsoft Exchange Public Folders with smartphones using CodeTwo Exchange Sync and Exchange ActiveSync. To learn more about CodeTwo Exchange Sync and download the free trial, go to: http://www.codetwo.com/excha…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

751 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