Microsoft® Windows® 2000 Scripting Guide
« Previous | Next »
When carrying out routine printer monitoring, you are likely to be concerned only with printers that are experiencing problems. Because of this, you might want to write a script that displays only printers that are not functioning correctly. For example, a print server in a large organization might handle 100 or more printers. If you return the status of every printer, you might have to search through 99 printers that are working in order to identify the single printer that has stopped responding. This not only wastes a considerable amount of time, but also increases the odds that you will overlook the one printer that is not working and thus not take immediate steps to correct the problem.
One of the prime benefits of WMI is that you can fine-tune the information returned. Instead of returning a list of all 100 printers, you can create a query that returns only a list of printers that are not responding. This makes it much faster and easier to identify the printers that are in need of immediate attention.
Listing 13.4 contains a script that issues a notification when a printer stops responding. To carry out this task, the script must perform the following steps:
To limit data retrieval to printers that have stopped, use a Where clause to restrict the collection to printers with a printer status equal to 1 (Other) or 2 (Unknown).
Listing 13.4 Receiving Notification When a Printer Stops
|
|
Send us your feedback | « Previous | Next » |