Solved

List all disabled users from a specified OU container in AD via VB script

Posted on 2011-03-17
9
708 Views
Last Modified: 2012-05-11
Hello...

Is there a way to list ALL disabled users from a specified OU container in AD via VB script and then output it in an Excel spreadsheet?

TY,
Quan
0
Comment
Question by:qvn7
9 Comments
 
LVL 57

Accepted Solution

by:
Mike Kline earned 168 total points
ID: 35158090
Does it have to be VBScript,  powershell and adfind can get this done in one line

adfind by MVP Joe Richards for this

http://www.joeware.net/freetools/tools/adfind/index.htm

adfind -b "DN of your OU" -bit -f  “&(objectcategory=person)(objectclass=user)(userAccountControl:AND:=2)” samaccountname  -nodn -csv  > c:\DisabledUsers.csv


...and if you want to find enabled users just add a !(exclamation point)  in front of useraccountcontrol

Thanks

Mike
0
 
LVL 27

Assisted Solution

by:KenMcF
KenMcF earned 166 total points
ID: 35158265
Just to add to Mike's response with Powershell and the Quest AD cmdlets

get-qaduser -searchroot "OU=USERSOU,DC=Domain,DC=Local" -disabled | Select samaccountname, Name | export-csv c:\DisabledUsers.csv

0
 
LVL 65

Assisted Solution

by:RobSampson
RobSampson earned 166 total points
ID: 35162351
Hi, try the script here....it will give you information on expired accounts as well.
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_23478121.html

Regards,

Rob.
0
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

by:qvn7
ID: 35167367
Thanks for all the info...
0
 

Author Comment

by:qvn7
ID: 35192143
TY Rob.  Sorry for the late response back.  Been busy at work.  Thanks for all of your help!!!
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 35361132
Hi, please don't forget to close the question.

Rob.
0
 
LVL 74

Expert Comment

by:Glen Knight
ID: 37433070
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

[b]Ok so now I will show you how to add a user name to the description at login. [/b] First connect to your DC (Domain Controller / Active Directory Server) SET PERMISSIONS FOR SCRIPT TO UPDATE COMPUTER DESCRIPTION TO USERNAME 1. Open Active …
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …
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 …

895 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