I have a legacy application that is printing, and I cannot disable this in the application. This task prints to a Windows defined printer queue. The issue I run into is that without a real printer attached, eventually the print queue gets full and then the jobs that are printing stop, waiting for the queue to respond that the job was accepted.
The legacy application is printing via the Powershell scripting.
if( sm_control_flag )
{
get-content $TO_PRINTER | Out-Printer -name $cfgs.PRINTER_QUEUE
}
The problem is that these scripts cannot be changed due to them being in production in distributed locations. There are a number of scripts that do this sort of process.
The Out-Printer needs to return a success, not an error, or the script will abort with a printing error. Therefore, the queue must exist (which is basically a printer defined in the Windows Server OS).
If there is not a real printer defined and attached to the queue, Windows will accept the job and queue the output to print. The issue is that the queue will eventually fill up the free space on the server, and then block all printing. The Powershell script's Out-Printer will also pause and wait for queue space to be freed up when the queue is full.
I cannot disable the printing on the computer and delete jobs, as other printers are connected and need to print. What I need is a printer driver that simply accepts the print job, but does nothing with it. I do not need it to print, just be deleted.
I was also trying to simply print to a file, so I could reuse same file name each time, which would overwrite the last print output, and meet my needs. The problem is that printing to a file always seems to prompt the user for the file name. This being a Windows server, there is no user to actually prompt for a file name from, so this blocks the queue and pauses the script as well.
Does anyone know of a way to accept the jobs and then simply delete the output and not print the job?
nul:
printer port that does exactly what the OP wants. Just map any printer driver to it, give the queue a name, and he'll have the print queue he needs listed in the system.