diff options
author | Andrew Tridgell <tridge@samba.org> | 2003-08-13 01:53:07 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2003-08-13 01:53:07 +0000 |
commit | cc3a6ea9920f30925a678c566b4af417da6d455b (patch) | |
tree | 60015a1a5f4b47ac3d133bdbbe32b75815595d4d /source4/python/examples/spoolss/enumprinters.py | |
parent | 4d1f9d1def5bf5fea64722626028d94da49c654c (diff) | |
parent | ef2e26c91b80556af033d3335e55f5dfa6fff31d (diff) | |
download | samba-cc3a6ea9920f30925a678c566b4af417da6d455b.tar.gz samba-cc3a6ea9920f30925a678c566b4af417da6d455b.tar.bz2 samba-cc3a6ea9920f30925a678c566b4af417da6d455b.zip |
This commit was generated by cvs2svn to compensate for changes in r30,
which included commits to RCS files with non-trunk default branches.
(This used to be commit 3a69cffb062d4f1238b8cae10481c1f2ea4d3d8b)
Diffstat (limited to 'source4/python/examples/spoolss/enumprinters.py')
-rwxr-xr-x | source4/python/examples/spoolss/enumprinters.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/source4/python/examples/spoolss/enumprinters.py b/source4/python/examples/spoolss/enumprinters.py new file mode 100755 index 0000000000..478c46bc24 --- /dev/null +++ b/source4/python/examples/spoolss/enumprinters.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python +# +# Display information on all printers on a print server. Defaults to +# printer info level 1. +# +# Example: enumprinters.py win2kdc1 +# + +import sys +from samba import spoolss + +if len(sys.argv) < 2 or len(sys.argv) > 3: + print "Usage: enumprinters.py <servername> [infolevel]" + sys.exit(1) + +printserver = sys.argv[1] + +level = 1 +if len(sys.argv) == 3: + level = int(sys.argv[2]) + +# Get list of printers + +try: + printer_list = spoolss.enumprinters("\\\\%s" % printserver) +except: + print "error enumerating printers on %s" % printserver + sys.exit(1) + +# Display basic info + +for printer in printer_list: + h = spoolss.openprinter("\\\\%s\\%s" % (printserver, printer)) + info = h.getprinter(level = level) + print "Printer info %d for %s: %s" % (level, printer, info) + print |