salut!
pour analyser les pcs de mon réseau, j'utilise MBSA qui se base sur des fichiers contenant la liste des ordis. cette liste est générée par un script qui récupère tous les "computers" dans AD.
voici le script:
**********************
Set fsobj = CreateObject("Scripting.FileSystemObject")
Set tf = fsobj.CreateTextFile("C:\script\ADres.txt", True)'crée le fichier ADres
Const ADS_SCOPE_SUBTREE = 2
Set objConnection = CreateObject("ADODB.Connection")
Set objCommand = CreateObject("ADODB.Command")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
"Select Name, Location from 'LDAP://DC=domaine1,DC=fr' " _
& "where objectClass='computer'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Timeout") = 30
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
objCommand.Properties("Cache Results") = False
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst
Do Until objRecordSet.EOF
tf.Write (objRecordSet.Fields("Name").Value &Chr(13)& Chr(10))
'Wscript.Echo "Computer Name: " & objRecordSet.Fields("Name").Value
'Wscript.Echo "Location: " & objRecordSet.Fields("Location").Value
objRecordSet.MoveNext
Loop
tf.Close
*************
ce script fonctionne très bien depuis une machine du même domaine.
Or si je veux scanner AD d'un autre domaine, j'ai cette erreur :
"Le tableau n'existe pas"
pourtant si j'execute ce script sur un poste du domaine2 il n'y a pas d'erreur.
dois-je inclure uneauthentification?si oui cmt? merci
