SUPINFO International University

SUPINFO Institute of Information Technology
Laboratoire Microsoft




Lister les imprimantes publiées dans AD

Accueil > Script > active_directory > Lister les imprimantes publiées dans AD

Lister les imprimantes publiées dans AD

Par Joachim GOMARD, LABORATOIRE SUPINFO DES TECHNOLOGIES MICROSOFT
Publiée le 27/10/2004 vers 13h.

Description :
Ce script VBS permet de lister les imprimantes publiées dans Active Directory.

Script :

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 printerName, serverName from " & " 'LDAP://DC=Nom du domaine,DC=com' where objectClass='printQueue'"
objCommand.Properties("Page Size") = 1000
objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE
Set objRecordSet = objCommand.Execute
objRecordSet.MoveFirst

Do Until objRecordSet.EOF
Wscript.Echo "Printer Name: " & objRecordSet.Fields("printerName").Value
Wscript.Echo "Server Name: " & objRecordSet.Fields("serverName").Value
objRecordSet.MoveNext
Loop



Proposer un script

Notre avis :

Votre avis :

Réactions :
0

Votants :
9

Visites :
13772

1
2
3
4
5

Script Précédent :

Mettre en pause une imprimante



Retrouvez ci-dessous les autres sections du Laboratoire Microsoft