Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

D:\Codigo Fuente\Windows Scripting Hosting\Terminado\ListDomains.

vbs

mircoles, 15 de junio de 2016 01:46 p.m.

'************************************************
' File: ListDomains.vbs (WSH sample in VBScript)
' Author: G. Born
'
' Lists the domains in a network
'************************************************
Option Explicit
Dim oNameSpace, oItem
Dim txt, title
title = "ADSI sample - Domain list"
txt = "Domains found: " & vbCRLF
' bind to ADs, if we just connect to the provider,
' we get a connect to namespace object
Set oNameSpace = GetObject("WinNT:")
' Now apply a filter to the domain
' to retrieve the requested data.
oNameSpace.Filter = Array("domain")
' Enumerate domains
For Each oItem in oNameSpace
txt = txt & oItem.Name & vbCRLF
Next
MsgBox txt, vbOkonly, title
' End

-1-

You might also like