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

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
qvn7Asked:
Who is Participating?
 
Mike KlineConnect With a Mentor Commented:
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
 
KenMcFConnect With a Mentor Commented:
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
 
RobSampsonConnect With a Mentor Commented:
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
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

 
qvn7Author Commented:
Thanks for all the info...
0
 
qvn7Author Commented:
TY Rob.  Sorry for the late response back.  Been busy at work.  Thanks for all of your help!!!
0
 
RobSampsonCommented:
Hi, please don't forget to close the question.

Rob.
0
 
Glen KnightCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.