?
Solved

Script to find all enabled users accounts inside AD doamin

Posted on 2010-08-29
6
Medium Priority
?
838 Views
Last Modified: 2013-12-24
Hello Dears,

I need a  scrip to find all enabled user accounts located in an Active directory domain.

Could someone help please ?

Thanks In advance!
0
Comment
Question by:Suliman Abu Kharroub
[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
6 Comments
 
LVL 39

Expert Comment

by:Krzysztof Pytko
ID: 33552793
type it in command-line on server or workstation with Administrative Tools installed

dsquery user -name * -limit 0| dsget user -fn -ln -samid -email -desc -disabled >c:\users.txt

Import text file into excel and filter it for "no" in disabled column.
0
 
LVL 1

Expert Comment

by:Jhonnyla
ID: 33552852
Hello,

I use powershell for querying AD and the quest activeroles management shell.  free download from:
http://www.quest.com/powershell/activeroles-server.aspx
Then you get AD specific commandlets.
the one below should give you all enabled users:
Get-QADUser -Enabled -SizeLimit 0
0
 
LVL 57

Expert Comment

by:Mike Kline
ID: 33553686
both methods given are good

I like using a great tool called adfind by Joe Richards

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

adfind -default -bit -f  "&(objectcategory=person)(objectclass=user)(!userAccountControl:AND:=2)" samaccountname displayname -csv > c:\EnabledUsers.csv

if you want disabled just run the same query but remove the ! before useraccountcontrol

That will give you a csv file on your C drive with all enabled users.

Thanks
Mike
0
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 
LVL 23

Author Comment

by:Suliman Abu Kharroub
ID: 33582127
Thanks all, sorry for the late reply. I was on vacation.

i will test and post back here.
0
 
LVL 23

Author Comment

by:Suliman Abu Kharroub
ID: 33606173
Thanks again.

@iSiek:
"dsget failed:Directory object not found" returned error.

the text file shows result but it is not complete.

@Jhonnyla: It give a correct info, but the result is shown all in a single column event when i run  :Get-QADUser -Enabled -SizeLimit 0 >c:\test.csv

can i export the result on excel file in three columns?

@mkline71:

"ldap_get_next_page_s: [DC-FQDN] Error 0x57 (87) - Filter Error" returned error
0
 
LVL 23

Accepted Solution

by:
Suliman Abu Kharroub earned 0 total points
ID: 33866949
0

Featured Post

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.

Question has a verified solution.

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

This article provides a convenient collection of links to Microsoft provided Security Patches for operating systems that have reached their End of Life support cycle. Included operating systems covered by this article are Windows XP,  Windows Server…
Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
This tutorial will show how to configure a new Backup Exec 2012 server and move an existing database to that server with the use of the BEUtility. Install Backup Exec 2012 on the new server and apply all of the latest hotfixes and service packs. The…
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…

719 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