Solved

Script to find all enabled users accounts inside AD doamin

Posted on 2010-08-29
6
835 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
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

Do you have a plan for Continuity?

It's inevitable. People leave organizations creating a gap in your service. That's where Percona comes in.

See how Pepper.com relies on Percona to:
-Manage their database
-Guarantee data safety and protection
-Provide database expertise that is available for any situation

Question has a verified solution.

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

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller singl…
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…
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…

630 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