Microsoft® Windows® 2000 Scripting Guide
« Previous | Next »
In addition to enumerating all the printers in a domain, you can search for specific printers. To do this, you simply search for printers that have one or more of the attributes of the printQueue object in Active Directory.
For example, to find all the color printers in the domain, you would search for all printers for which the printsColor attribute is True. To find printers that support stapling, you would search for all printers for which the printStaplingSupported attribute is True.
The printQueue object attributes are shown in Table 13.9.
Table 13.9 Attributes for the printQueue Object
Attribute | Friendly Name | Description |
---|---|---|
cn | Directory Service Name | Name of the printer as viewed in Active Directory Users and Computers. |
uNCName | Network Name | UNC path of the printer. This attribute is populated by the print spooler when the printQueue object is created. |
assetNumber | Asset Number | Asset number assigned to the printer. This attribute can be configured by using ADSI. |
contactName | Contact | Name of the person to contact regarding the printer. This attribute can be configured by using ADSI. |
description | Comment | Description of the printer. This is derived from the printer object at the time the printQueue object is created. |
driverName | Model | Model of the printer. This is derived from the printer driver at the time the printQueue object is created. |
location | Location | Physical location of the printer. This attribute can be configured by using ADSI. |
portName | Port | Name of the port(s) supporting this printer. This attribute is populated by the print spooler when the printQueue object is created. |
printBinNames | Input Trays | Input tray names. This attribute is populated by the printer driver when the printQueue object is created. |
printCollate | Supports Collation | Indicates whether or not the printer supports collation. This attribute is populated by the printer driver when the printQueue object is created. |
printColor | Supports Color Printing | Indicates whether or not this is a color device. This attribute is populated by the printer driver when the printQueue object is created. |
printDuplexSupported | Supports Double-sided Printing | Indicates whether or not this device can print on both sides of the paper. This attribute is populated by the printer driver when the printQueue object is created. |
printerName | Name | Name of the printer. This attribute is populated by the print object when the printQueue object is created. |
printLanguage | Printer Language | Page description language used by the printer. This attribute is populated by the printer driver when the printQueue object is created. |
printMaxResolutionSupported | Maximum Resolution | Maximum resolution (in DPI). This attribute is populated by the printer driver when the printQueue object is created. |
printMediaReady | Paper Available | Paper types loaded in the device at the present time. This attribute is populated by the printer driver when the printQueue object is created. |
printMediaSupported | Paper Types Supported | Media types that the printer supports. This attribute is populated by the printer driver when the printQueue object is created. |
printMemory | Installed Memory | Amount of installed memory. This attribute is populated by the printer driver when the printQueue object is created. |
printOwner | Owner Name | Name of the person or group that owns the printer. This attribute can be configured by using ADSI. |
printRate | Speed | Speed of the device. This attribute is populated by the printer driver when the printQueue object is created. |
printRateUnit | Speed Units | Units that the printer speed is measured in. This attribute is populated by the printer driver when the printQueue object is created. |
printPagesPerMinute | Pages per Minute | Printer speed normalized to pages per minute. This attribute is populated by the printer driver when the printQueue object is created. |
printShareName | Share Name | Share name of the printer. This attribute is populated by the print object when the printQueue object is created. |
printStaplingSupported | Supports Stapling | Indicates whether or not the device can staple. This attribute is populated by the printer driver when the printQueue object is created. |
serverName | Server Name | Name of the server supporting the printer. This attribute is populated by the print spooler when the printQueue object is created. |
url | Web Page Address | URL of the printer s Web page. This attribute is populated by the print spooler when the printQueue object is created. |
versionNumber | Object Version | Internal version number of the printer object. This attribute is populated by the print spooler when the printQueue object is created. |
Listing 13.26 contains a script that searches for specific printers in Active Directory. To carry out this task, the script must perform the following steps:
The connection object allows you to connect to Active Directory.
The command object allows you to issue queries and other database commands using the Active Directory connection.
To limit data retrieval to printers with a priority of 2, add the statement "and Priority = 2" to the Where clause. To ensure a quicker search, include only the attributes printerName and serverName in the SQL query.
Listing 13.26 Searching for Specific Printers in Active Directory
|
|
Send us your feedback | « Previous | Next » |