;; 
;;=====================================================================================----- 
;; 
;;FUNCTION       GetMachineList() 
;; 
;;ACTION         Returns a list of all computers in a specified domain 
;; 
;;AUTHOR         Glenn Barnas 
;; 
;;VERSION        1.0 - 2003/03/19 
;; 
;;HISTORY        1.0 - 2003/03/19 - Initial Release 
;; 
;;SYNTAX         GetMachineList(domain_name) 
;; 
;;PARAMETERS     domain_name - Required - String 
;;               - Name of the domain to scan 
;; 
;;REMARKS         
;; 
;;RETURNS        Array of computer names - unsorted, & may contain duplicates! 
;; 
;;DEPENDENCIES   none 
;; 
;;TESTED WITH    NT4, W2K, WXP 
;; 
;;EXAMPLES        
; 
Function GetMachineList($DomainName)
	
  Dim $_Machines[0], $_iX, 
  Dim $_Domain
  Dim $_Container, $_Computer
 
  $_iX = -1
	
  ;Create domain object 
  $_Domain = GetObject("WinNT://" + $_DomainName + ",domain")
	
  ;Set container object equal to domain object. 
  $_Container = $_Domain
	
  ;Iterates through EVERY object in the domain.  Those 
  ;objects that match the class are included in the array. 
  For Each $_Computer In $_Container
	  
    If $_Computer.Class = 'Computer'
      $_iX = $_iX + 1
      ReDim Preserve $_Machines[$_iX]
      $_Machines[$iX] = $_Computer.Name
    EndIf
	  
  Next	
	
  If $_iX >= 0
    ; Return the $Machines array... 
    $GetMachineList = $_Machines
 
  Else
 
    $GetMachineList = ''
	
  EndIf
	
  ;Object cleanup 
  $_Domain = 0
  $_Container = 0
	
EndFunction