How-to: List all User accounts from Active Directory

List all the user accounts in a specific domain.

'ListUsers.vbs
On Error Resume Next

Set objDomain = GetObject("WinNT://SS64Domain")

WScript.echo "Domain : " + objDomain.name

For each objDomainItem in objDomain
  if objDomainItem.Class = "User" then
     WScript.echo objDomainItem.Name + " : Full Name: " + objDomainItem.FullName
  end if
Next

Example

cscript listusers.vbs

“An honest tale speeds best, being plainly told” ~ William Shakespeare, Richard III, Act IV, Scene IV

Related:

SearchAD - Search AD for Users, Computers or Groups.
UserInfo - List properties of a User (as shown in ADUC).
Powershell : Get-adUser


 
Copyright © 1999-2020 SS64.com
Some rights reserved