Controlling printer access based on time
Contents
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 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 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:
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.
For more information see Scheduling server commands.
Categories: How-to Articles , Print Queues
Last updated February 15, 2024
Comments