Re: How to detect all domain machines with script?
From: Scott Cooper (scooper02@earthlink.net)
Date: 11/20/02
- Next message: Dario de Judicibus: "[HELP] Full control permission revoked to administrator and system"
- Previous message: Erik Wochok: "Bypassing the logon screen for Windows 2K"
- In reply to: A. Tolga KILINĒ: "How to detect all domain machines with script?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: "Scott Cooper" <scooper02@earthlink.net> Date: Tue, 19 Nov 2002 15:34:55 -0800
In each domain you can enumerate the domain controllers OU (this is the
easiest method).
set DCList = GetObject(LDAP://ou=domain controllers, dc=domain, dc=com)
For each DCObj in DCList
servername = DCObj.cn
Next
Or if you want all domain controllers in the forest, I suggest using an ADO
method. This method will look for the site server object in the
configuration partition.
Set oRoot = GetObject("LDAP://RootDSE")
sDNSDomain = "cn=configuration," & oRoot.Get("rootDomainNamingContext")
Set oCmd = CreateObject("ADODB.Command")
Set oCon = CreateObject("ADODB.Connection")
oCon.Provider = "ADsDSOObject"
oCon.Open = "Active Directory Provider"
oCmd.ActiveConnection = oCon
sQuery = "SELECT Name FROM 'LDAP://" _
& sDNSDomain & "' WHERE objectCategory = 'server'"
oCmd.CommandText = sQuery
oCmd.Properties("Searchscope") = 2
oCmd.Properties("Cache Results") = False
Set oRS = oCmd.Execute
While not oRS.EOF
wscript.echo oRS.Fields("Name")
oRS.MoveNext
Wend
"A. Tolga KILINĒ" <kilinc@tis.havelsan.com.tr> wrote in message
news:OLKF0sviCHA.1652@tkmsftngp11...
> Hi,
> How can I detect all domain machines with an ADSI script? Is there any
> example script for this?
> Regards,
> Tolga
>
>
>
- Next message: Dario de Judicibus: "[HELP] Full control permission revoked to administrator and system"
- Previous message: Erik Wochok: "Bypassing the logon screen for Windows 2K"
- In reply to: A. Tolga KILINĒ: "How to detect all domain machines with script?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|
|