How-to: List all User accounts from Active Directory

List all the user accounts in a specific domain.

On Error Resume Next

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

WScript.echo "Domain : " +

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


cscript listusers.vbs

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

Related VBScript commands

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

Copyright © 1999-2023
Some rights reserved