summaryrefslogtreecommitdiff
path: root/source3/python/examples/spoolss/enumprinters.py
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-05-02 05:23:38 +0000
committerTim Potter <tpot@samba.org>2002-05-02 05:23:38 +0000
commitaa69c1ee80fbf7f45d61861089daeb5828e91229 (patch)
treedb681d1494af3ff0d1a7ec48ffa86cd5150428c5 /source3/python/examples/spoolss/enumprinters.py
parent9d4f9bda320be9c17f2cf95ecd4d230f6a5283e5 (diff)
downloadsamba-aa69c1ee80fbf7f45d61861089daeb5828e91229.tar.gz
samba-aa69c1ee80fbf7f45d61861089daeb5828e91229.tar.bz2
samba-aa69c1ee80fbf7f45d61861089daeb5828e91229.zip
Some examples using the spoolss python module.
(This used to be commit 68b952561429e1d08a974e633bb9c2870c819c69)
Diffstat (limited to 'source3/python/examples/spoolss/enumprinters.py')
-rwxr-xr-xsource3/python/examples/spoolss/enumprinters.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/source3/python/examples/spoolss/enumprinters.py b/source3/python/examples/spoolss/enumprinters.py
new file mode 100755
index 0000000000..bf08b95bb9
--- /dev/null
+++ b/source3/python/examples/spoolss/enumprinters.py
@@ -0,0 +1,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"])