Solved

Disabling AD Accounts through scripting

Posted on 2011-03-22
3
384 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
Comment Utility
dsmod user "CN=John Smith,CN=Users,DC=MyDomain,DC=Com" -disabled yes
0
 
LVL 4

Accepted Solution

by:
philetaylor earned 167 total points
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
A procedure for exporting installed hotfix details of remote computers using powershell
In this video we show how to create an Address List in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Organization >> Ad…
This video discusses moving either the default database or any database to a new volume.

762 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

11 Experts available now in Live!

Get 1:1 Help Now