ADSI scripting template that runs the script against all the computer found in the Computers container in the domain fabrikam.com.

Visual Basic
Edit|Remove
On Error Resume Next

Set objOU = GetObject("LDAP://CN=Computers,dc=fabrikam,dc=com"
objOU.Filter = Array("Computer")

For Each objComputer in objOU
    strComputer = objComputer.CN

    ' =====================================================================
    ' Insert your code here
    ' =====================================================================

    Set objComputer = GetObject("WinNT://" & strComputer & "")
    objComputer.Filter = Array("User")
    For Each objUser in objComputer
        Wscript.Echo objUser.Name
    Next

    ' =====================================================================
    ' End
    ' =====================================================================

Next