summaryrefslogtreecommitdiff
path: root/source3/python/examples/spoolss/enumprinters.py
blob: bf08b95bb95f08068547148264de3f9e69b4c0d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python
#
# Display information on all printers on a print server
#

import sys, spoolss

if len(sys.argv) != 2:
    print "Usage: changeid.py <printername>"
    sys.exit(1)

printserver = sys.argv[1]

# Get list of printers

try:
    printer_list = spoolss.enumprinters(printserver)
except:
    print "error enumerating printers on %s" % printserver
    sys.exit(1)

# Display basic info

for printer in printer_list:
    print "%s: %s" % (printer["printer_name"], printer["comment"])