summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-09-10 06:41:27 +0000
committerTim Potter <tpot@samba.org>2002-09-10 06:41:27 +0000
commitd4b6d5db9145ae62c99e2432cf524f83fdc72277 (patch)
tree980bd903a0c2618587817d249cc3f72af1b29240
parent5793e15a27bf9f3bd00120ab0ff000b3935b19bf (diff)
downloadsamba-d4b6d5db9145ae62c99e2432cf524f83fdc72277.tar.gz
samba-d4b6d5db9145ae62c99e2432cf524f83fdc72277.tar.bz2
samba-d4b6d5db9145ae62c99e2432cf524f83fdc72277.zip
Updated examples for new top level module layout.
Fixed some bugs also. (This used to be commit 3e19e3afdb6fd1f63dee9ca52a5d33090670832e)
-rwxr-xr-xsource3/python/examples/spoolss/changeid.py7
-rwxr-xr-xsource3/python/examples/spoolss/enumprinters.py23
-rwxr-xr-xsource3/python/examples/spoolss/psec.py3
3 files changed, 25 insertions, 8 deletions
diff --git a/source3/python/examples/spoolss/changeid.py b/source3/python/examples/spoolss/changeid.py
index b2345094ed..85fe0efe8a 100755
--- a/source3/python/examples/spoolss/changeid.py
+++ b/source3/python/examples/spoolss/changeid.py
@@ -2,8 +2,13 @@
#
# Display the changeid for a list of printers given on the command line
#
+# Sample usage:
+#
+# changeid.py '\\win2kdc1\magpie'
+#
-import sys, spoolss
+import sys
+from samba import spoolss
if len(sys.argv) == 1:
print "Usage: changeid.py <printername>"
diff --git a/source3/python/examples/spoolss/enumprinters.py b/source3/python/examples/spoolss/enumprinters.py
index bf08b95bb9..478c46bc24 100755
--- a/source3/python/examples/spoolss/enumprinters.py
+++ b/source3/python/examples/spoolss/enumprinters.py
@@ -1,20 +1,28 @@
#!/usr/bin/env python
#
-# Display information on all printers on a print server
+# Display information on all printers on a print server. Defaults to
+# printer info level 1.
+#
+# Example: enumprinters.py win2kdc1
#
-import sys, spoolss
+import sys
+from samba import spoolss
-if len(sys.argv) != 2:
- print "Usage: changeid.py <printername>"
+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(printserver)
+ printer_list = spoolss.enumprinters("\\\\%s" % printserver)
except:
print "error enumerating printers on %s" % printserver
sys.exit(1)
@@ -22,4 +30,7 @@ except:
# Display basic info
for printer in printer_list:
- print "%s: %s" % (printer["printer_name"], printer["comment"])
+ h = spoolss.openprinter("\\\\%s\\%s" % (printserver, printer))
+ info = h.getprinter(level = level)
+ print "Printer info %d for %s: %s" % (level, printer, info)
+ print
diff --git a/source3/python/examples/spoolss/psec.py b/source3/python/examples/spoolss/psec.py
index f3fdb7bccd..498a0ef174 100755
--- a/source3/python/examples/spoolss/psec.py
+++ b/source3/python/examples/spoolss/psec.py
@@ -3,7 +3,8 @@
# Get or set the security descriptor on a printer
#
-import sys, spoolss, re, string
+import sys, re, string
+from samba import spoolss
if len(sys.argv) != 3:
print "Usage: psec.py getsec|setsec printername"