Solved

Disabling AD Accounts through scripting

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Scam emails are a huge burden for many businesses. Spotting one is not always easy. Follow our tips to identify if an email you receive is a scam.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
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…
In this video we show how to create an email address policy 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 Mail Flow…

863 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

23 Experts available now in Live!

Get 1:1 Help Now