tsotb
Messages postés19Date d'inscriptionjeudi 18 décembre 2003StatutMembreDernière intervention22 juillet 2005
-
22 juin 2005 à 07:59
tsotb
Messages postés19Date d'inscriptionjeudi 18 décembre 2003StatutMembreDernière intervention22 juillet 2005
-
22 juin 2005 à 15:22
salut !
j'ai un script vbs (trouvé dans l'aide de vbs factory) pour récupérer la liste des ordinateurs qui se trouvent ds Acrtive Directory.
voici ce code:
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=fabrikam,DC=com' " _
& "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
Wscript.Echo "Computer Name: " & objRecordSet.Fields("Name").Value
Wscript.Echo "Location: " & objRecordSet.Fields("Location").Value
objRecordSet.MoveNext
Loop
----------------------
en testant ainsi j'ai l'erreur "le tableau n'existe pas" je pense bien évidemment qu'il faut changer le DC
"Select Name, Location from 'LDAP://DC=fabrikam,DC=com' " _
fabrikam-->mondomaine et com-->com ou fr suivant mon domaine c'est ça? parce que c'a n'apas l'air de marcher. j'ai la même erreur.Y-a t-il un pb de droits? Où faut il s'identifier?