Solved

Disabling AD Accounts through scripting

Posted on 2011-03-22
3
387 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 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

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

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This article outlines the process to identify and resolve account lockout in an Active Directory environment.
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

803 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