Scripting Blog [archived]

Formerly known as the "Hey, Scripting Guy!" blog

Latest posts

Can I Get a List of All My User Accounts?
Aug 11, 2004
Post comments count 0
Post likes count 0

Can I Get a List of All My User Accounts?

ScriptingGuy1
ScriptingGuy1

Hey, Scripting Guy! Is there any way to get a list of all the user accounts in Active Directory?-- CB, Fremont, CA Hey, CB. By far the quickest and easiest way to do this is to search Active Directory for all your user accounts. Here’s a sample script that searches the fabrikam.com domain; to search your own domain, just edit the LDAP connection string (‘LDAP://dc=fabrikam,dc=com’) as needed. For example, if your domain is named contoso.com, you’d change the connection string to ‘LDAP://dc=contoso,dc=com’. There’s too much going on in this script to explain it all here; if you’re interested in how and why this w...