1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-18 08:23:51 +03:00

Some examples using the spoolss python module.

This commit is contained in:
Tim Potter
-
parent 58cf23f4da
commit 68b9525614
3 changed files with 141 additions and 0 deletions

View File

@@ -0,0 +1,29 @@
#!/usr/bin/python
#
# Display the changeid for a list of printers given on the command line
#
import sys, spoolss
if len(sys.argv) == 1:
print "Usage: changeid.py <printername>"
sys.exit(1)
for printer in sys.argv[1:]:
# Open printer handle
try:
hnd = spoolss.openprinter(printer)
except:
print "error opening printer %s" % printer
sys.exit(1)
# Fetch and display changeid
info = hnd.getprinter(level = 0)
print info["change_id"]
# Clean up
spoolss.closeprinter(hnd)