Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

root

1 réponse
Avatar
rénald
Bonjour,

Je cherche un script WSH pour me connecter au root d'un DC et pour pouvoir
lister tous les postes "ordinateurs" et "domain controller"

Une idée ?

merci

Rénald

1 réponse

Avatar
Gilles LAURENT [MVP]
"rénald" a écrit dans le message de
news:
| Bonjour,

Bonjour,

| Je cherche un script WSH pour me connecter au root d'un DC et pour
| pouvoir lister tous les postes "ordinateurs" et "domain controller"

--- Coupez ici : FindComputers.vbs ---
Option Explicit

' déclaration des variables
Dim oCon, oCmd, oRs

' initialisation des objets
Set oCon=CreateObject("adodb.connection")
oCon.Open "Provider­sDSOObject"
Set oCmd=CreateObject("adodb.command")
oCmd.ActiveConnection=oCon

' définition de la requête ldap
oCmd.CommandText="<LDAP://" & GetObject("LDAP://RootDSE"). _
Get("defaultNamingContext") & ">;" & _
"(objectCategory=Computer);" & _
"distinguishedname;subtree"

' exécution de la requête
set oRs=oCmd.Execute()

' affichage du dn des ordinateurs
While Not oRs.EOF
WScript.Echo oRs.Fields(0)
oRs.MoveNext
Wend
--- Coupez ici : FindComputers.vbs ---

--
Gilles LAURENT
MVP Windows Server - Admin Frameworks
http://glsft.free.fr