List Computers

List all the computers in a given domain.

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

WScript.echo "Domain : " + objDomain.name

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

Examples

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:

SearchAD - Search Active Directory for Users, Computers or groups.
ComputerInfo - List Computer properties (as shown in ADUC)
Powershell: Get-adComputer - Get one or more AD computers.
Get-QADComputer | Select-Object -Property name - Retrieve computer objects


© Copyright SS64.com 1999-2014
Some rights reserved