Solved

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

Posted on 2011-03-17
9
702 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:qvn7
Comment Utility
Thanks for all the info...
0
 

Author Comment

by:qvn7
Comment Utility
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
Comment Utility
Hi, please don't forget to close the question.

Rob.
0
 
LVL 74

Expert Comment

by:Glen Knight
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

763 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