• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 736
  • Last Modified:

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
0
qvn7
Asked:
qvn7
3 Solutions
 
Mike KlineCommented:
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
 
KenMcFCommented:
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
 
RobSampsonCommented:
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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now