How-to: List Computers

List all the computers in a given domain.

' ListComputers.vbs
On Error Resume Next
Set objDomain = GetObject("WinNT://SS64Domain")

WScript.echo "Domain : " +

For each objDomainItem in objDomain
  if objDomainItem.Class = "Computer" then
     WScript.echo objDomainItem.Name
  end if


cscript listcomputers.vbs

“Microsoft was founded with a vision of a computer on every desk, and in every home. We've never wavered from that vision” ~ Bill Gates

Related VBScript commands

SearchAD - Search Active Directory for Users, Computers or groups.
ComputerInfo - List Computer properties (as shown in ADUC).
Equivalent PowerShell: Get-adComputer - Get one or more AD computers.

Copyright © 1999-2023
Some rights reserved