Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Disabling AD Accounts through scripting

Posted on 2011-03-22
3
Medium Priority
?
399 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
3 Comments
 
LVL 70

Assisted Solution

by:KCTS
KCTS earned 664 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 668 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 668 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

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

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

How to effectively resolve the number one email related issue received by helpdesks.
If you have come across a situation where you need to find some EDB mailbox recovery techniques, then here you will find the same. In this article, we will take you through three techniques using which you will be able to perform EDB recovery. You …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

927 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