Controlling printer access based on time

KB Home   |   Controlling printer access based on time

Main.ControllingPrinterAccessBasedOnTime History

Hide minor edits - Show changes to output

April 15, 2013, at 10:49 PM by ian - Fix accidental enable/disable swap from 2009 - oops.
Changed lines 29-30 from:
         server-command.exe enable-printer "printsrv1" "labprinter"
to:
         server-command.exe disable-printer "printsrv1" "labprinter" -1
Changed lines 35-36 from:
         server-command.exe disable-printer "printsrv1" "labprinter"
to:
         server-command.exe enable-printer "printsrv1" "labprinter"
May 27, 2011, at 03:42 AM by peter - Added link to a script for time-based access
Changed lines 5-6 from:
In this case a script can test the time of the print job.  If during a particular time of day the job can be cancelled and a message sent to the user (via the user client software).  Sample scripts are available as recipes and snippets within the PaperCut interface.
to:
In this case a [[TimeBasedAccessScript|script]] can test the time of the print job.  If during a particular time of day the job can be cancelled and a message sent to the user (via the user client software).  Sample scripts are available as recipes and snippets within the PaperCut interface.
Changed lines 10-11 from:
!! Controlling with web-service or server command (before 10.1)
to:
!!! Controlling with web-service or server command (before 10.1)
July 06, 2010, at 05:46 AM by matt - Mention print scripting.
Changed lines 3-6 from:
This knowledge base article related to [[https://www.papercut.com/products/ng/ | PaperCut NG]].

PaperCut NG
comes with a comprehensive set of XML web services API's and a set of command-line tools for use in traditional scripting environments such as batch files or shell scripts.  These tools can be used to control accounts, settings and printer access.  One example of their use is controlling printer access based on time of day.  Here is an example on how to set this up:
to:
Controlling access to printers based on time can be useful in a number of circumstances.  Since PaperCut 10.1 the simplest way to achieve this is with the [[https://www.papercut.com/tour/advanced-scripting/ | Advanced Scripting feature]].  Scripting allows for writing small scripts in Javascript to control and customize how print jobs are handled by PaperCut.

In this case a script can test the time of the print job.  If during a particular time of day the job can be cancelled and a message sent to the user (via the user client software).  Sample scripts are available as recipes and snippets within the PaperCut interface.

For documentation on Advanced Print Scripting see the [[https://www.papercut.com/products/ng/manual/ch-script.html | manual]].


!! Controlling with web-service or server command (before 10.1)

PaperCut
comes with a comprehensive set of XML web services API's and a set of command-line tools for use in traditional scripting environments such as batch files or shell scripts.  These tools can be used to control accounts, settings and printer access.  One example of their use is controlling printer access based on time of day.  Here is an example on how to set this up:
Changed lines 22-23 from:
         server-command.exe set-printer-property "printsrv1" "labprinter" disabled TRUE
to:
         server-command.exe enable-printer "printsrv1" "labprinter"
Changed lines 28-29 from:
         server-command.exe set-printer-property "printsrv1" "labprinter" disabled FALSE
to:
         server-command.exe disable-printer "printsrv1" "labprinter"
Changed lines 22-23 from:
         server-command.exe disable-printer "printsrv1" "labprinter" "-1"
to:
         server-command.exe set-printer-property "printsrv1" "labprinter" disabled TRUE
Changed lines 28-29 from:
         server-command.exe enable-printer "printsrv1" "labprinter"
to:
         server-command.exe set-printer-property "printsrv1" "labprinter" disabled FALSE
October 06, 2008, at 12:50 AM by 218.214.136.161 -
Changed lines 40-41 from:
For more information on scheduling server commands see [[SchedulingServerCommands|+]].
to:
For more information see [[SchedulingServerCommands|+]].
October 06, 2008, at 12:48 AM by 218.214.136.161 -
Added lines 39-41:

For more information on scheduling server commands see [[SchedulingServerCommands|+]].

Changed lines 1-2 from:
This knowledge base article related to [[http://www.papercut.biz/pcng/ |PaperCut NG]].
to:
(:title Controlling printer access based on time:)

This knowledge base article related to [[http://papercut.biz/products/ng/ |
PaperCut NG]].
Changed line 39 from:
to:
''Categories:'' [[!Printers]]
March 20, 2006, at 10:51 PM by httpwwwpapercutbizpcngmanualch-secondary-printhtml -
Added line 6:
March 20, 2006, at 10:51 PM by httpwwwpapercutbizpcngmanualch-secondary-printhtml -
Changed line 10 from:
'''1.''' Log into the server as [@administrator@]
to:
->'''1.''' Log into the server as [@administrator@]
Changed lines 12-15 from:
'''2.''' Create two text files (renamed to bat files) called:
      open-printer-access.bat
      close-printer-access.bat
->in the location [@C:\Program Files\PaperCut NG\server\custom@]
to:
->'''2.''' Create two text files (renamed to bat files) called:
        open-printer-access.bat
        close-printer-access.bat
-->in the location [@C:\Program Files\PaperCut NG\server\custom@]
Changed lines 17-19 from:
'''3.''' In [@close-printer-access.bat@] add the text:
      cd c:\program files\papercut ng\server\bin\win
      server-command.exe disable-printer "printsrv1" "labprinter" "-1"
to:
->'''3.''' In [@close-printer-access.bat@] add the text:
        cd c:\program files\papercut ng\server\bin\win
        server-command.exe disable-printer "printsrv1" "labprinter" "-1"
Changed line 21 from:
->Note: The value [@-1@] indicates to disable the printer forever - that is until is is manually re-enabled.
to:
-->Note: The value [@-1@] indicates to disable the printer forever - that is until is is manually re-enabled.
Changed lines 23-25 from:
'''4.''' In [@open-printer-access.bat@] add the text:
      cd c:\program files\papercut ng\server\bin\win
      server-command.exe enable-printer "printsrv1" "labprinter"
to:
->'''4.''' In [@open-printer-access.bat@] add the text:
        cd c:\program files\papercut ng\server\bin\win
        server-command.exe enable-printer "printsrv1" "labprinter"
Changed line 27 from:
'''5.''' Double-click on [@close-printer-access.bat@] and verify that the printer is disabled and printing is denied.  Then Double-click on [@open-printer-access.bat@] and verify that printing is re-enabled.
to:
->'''5.''' Double-click on [@close-printer-access.bat@] and verify that the printer is disabled and printing is denied.  Then Double-click on [@open-printer-access.bat@] and verify that printing is re-enabled.
Changed lines 29-31 from:
'''6.''' Use the ''Windows Task Scheduler'' under [@Start->Control Panel->Scheduled Tasks@] to add two new tasks as follows:
# Schedule [=close-printer-access.bat=] to run on at 5:00pm on weekdays.
# Schedule [=open-printer-access.bat=] to run on at 8:00am on weekdays.
to:
->'''6.''' Use the ''Windows Task Scheduler'' under [@Start->Control Panel->Scheduled Tasks@] to add two new tasks as follows:
Changed lines 31-34 from:
->Note: More information on the ''Windows Task Scheduler'' in the Windows help system.
to:
**Schedule [=close-printer-access.bat=] to run on at 5:00pm on weekdays.
**Schedule [=open-printer-access.bat=] to run on at 8:00am on weekdays.

-
->Note: More information on the ''Windows Task Scheduler'' in the Windows help system.
March 20, 2006, at 10:48 PM by httpwwwpapercutbizpcngmanualch-secondary-printhtml -
Changed line 10 from:
'''1.''' Log into the server as [=administrator=]
to:
'''1.''' Log into the server as [@administrator@]
Changed line 15 from:
->in the location [=C:\Program Files\PaperCut NG\server\custom=]
to:
->in the location [@C:\Program Files\PaperCut NG\server\custom@]
Changed line 17 from:
'''3.''' In [=close-printer-access.bat=] add the text:
to:
'''3.''' In [@close-printer-access.bat@] add the text:
Changed line 21 from:
->Note: The value [=-1=] indicates to disable the printer forever - that is until is is manually re-enabled.
to:
->Note: The value [@-1@] indicates to disable the printer forever - that is until is is manually re-enabled.
Changed line 23 from:
'''4.''' In [=open-printer-access.bat=] add the text:
to:
'''4.''' In [@open-printer-access.bat@] add the text:
Changed line 27 from:
'''5.''' Double-click on [=close-printer-access.bat=] and verify that the printer is disabled and printing is denied.  Then Double-click on [=open-printer-access.bat=] and verify that printing is re-enabled.
to:
'''5.''' Double-click on [@close-printer-access.bat@] and verify that the printer is disabled and printing is denied.  Then Double-click on [@open-printer-access.bat@] and verify that printing is re-enabled.
Changed line 29 from:
'''6.''' Use the ''Windows Task Scheduler'' under [=Start->Control Panel->Scheduled Tasks=] to add two new tasks as follows:
to:
'''6.''' Use the ''Windows Task Scheduler'' under [@Start->Control Panel->Scheduled Tasks@] to add two new tasks as follows:
March 20, 2006, at 10:47 PM by httpwwwpapercutbizpcngmanualch-secondary-printhtml -
Changed lines 1-36 from:
Describe ControllingPrinterAccessBasedOnTime here.
to:
This knowledge base article related to [[http://www.papercut.biz/pcng/ PaperCut NG]].

PaperCut NG comes with a comprehensive set of XML web services API's and a set of command-line tools for use in traditional scripting environments such as batch files or shell scripts.  These tools can be used to control accounts, settings and printer access.  One example of their use is controlling printer access based on time of day.  Here is an example on how to set this up:

This example assumes:
* PaperCut NG is set up on a Windows print server named "printsrv1"
* There is a printer access on the server called "labprinter"
* The administrator would like the printer disabled between 5:00pm and 8:00am on week days.

'''1.''' Log into the server as [=administrator=]

'''2.''' Create two text files (renamed to bat files) called:
      open-printer-access.bat
      close-printer-access.bat
->in the location [=C:\Program Files\PaperCut NG\server\custom=]

'''3.''' In [=close-printer-access.bat=] add the text:
      cd c:\program files\papercut ng\server\bin\win
      server-command.exe disable-printer "printsrv1" "labprinter" "-1"

->Note: The value [=-1=] indicates to disable the printer forever - that is until is is manually re-enabled.

'''4.''' In [=open-printer-access.bat=] add the text:
      cd c:\program files\papercut ng\server\bin\win
      server-command.exe enable-printer "printsrv1" "labprinter"

'''5.''' Double-click on [=close-printer-access.bat=] and verify that the printer is disabled and printing is denied.  Then Double-click on [=open-printer-access.bat=] and verify that printing is re-enabled.

'''6.''' Use the ''Windows Task Scheduler'' under [=Start->Control Panel->Scheduled Tasks=] to add two new tasks as follows:
# Schedule [=close-printer-access.bat=] to run on at 5:00pm on weekdays.
# Schedule [=open-printer-access.bat=] to run on at 8:00am on weekdays.

->Note: More information on the ''Windows Task Scheduler'' in the Windows help system.


     

Comments

Share your findings and experience with other PaperCut users. Feel free to add comments and suggestions about this Knowledge Base article. Please don't use this for support requests.

Article last modified on April 15, 2013, at 10:49 PM
Printable View   |   Article History   |   Edit Article