Solved

Script to find all enabled users accounts inside AD doamin

Posted on 2010-08-29
6
824 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
6 Comments
 
LVL 39

Expert Comment

by:Krzysztof Pytko
Comment Utility
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
Comment Utility
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
Comment Utility
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
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

 
LVL 23

Author Comment

by:Suliman Abu Kharroub
Comment Utility
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
Comment Utility
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
Comment Utility
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Disabling the Directory Sync Service Account in Office 365 will stop directory synchronization from working.
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…
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…

772 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