Solved

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

Posted on 2011-03-17
9
713 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
This article explains the steps required to use the default Photos screensaver to display branding/corporate images
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 from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

696 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