1

I'm trying to make a powershell script that will make it easy for a machine operator to clear prints from a customized Zebra printer.

Context: This printer does not operate like a regular Zebra printer, it will only print after getting a print signal from the equipment the operator is working on. For regular labeling this is not a problem.

The problem I am trying to solve occurs on printing jobs where each label is unique, and you have hundreds of prints in a job. This will cause the print job to be sitting partially in the Win print queue waiting to be sent to the printer.

And if you have to interrupt this job, you have to manually clear the queue, and then clear the remaining prints off the Zebra printer.

I am trying to make this as easy and quick as possible for the operator.

PS C:\Users\Ballsprett> Get-PrintJob -PrinterName Zebra1

Id    ComputerName    PrinterName     DocumentName         SubmittedTime        JobStatus      
--    ------------    -----------     ------------         -------------        ---------      
10                    Zebra1          Thelabel.lbl         12/15/2020 3:42:4... Error, Print...

I'd like to create a clickable script that just by doubleclicking it will get me the Id on this printer, so I can remove/cler the print job.

Remove-PrintJob -PrinterName Zebra1 -ID 10

I'd like the script to find the ID on this printer, and either put it into a variable or remove the job directly. I've gotten this far, but if I try a variable, it will put it like this:

PS C:\Users\Ballsprett> Get-Variable PriID

Name                           Value
----                           -----
PriID                          MSFT_PrintJob (Id = 7, PrinterName = "Zebra1")

I can't figure out how to use this.

--

Then, after the job is removed, I'd like to send the command ~JA to clear the prints off the printer. It is only those three characters, but I may need to add CR to it, haven't gotten that far yet.

I know this will include using

Out-Printer -Name "Zebra1"

I do not know how to send just characters/text stream to the printer. All info and examples I see is for sending files, not just pure ASCII text.

Any help would be appreciated.

4
  • Perhaps you can assign it a variable like you described like so? $x = Get-PrintJob -PrinterName Zebra1 then call $x.id does that work? Commented Dec 16, 2020 at 14:08
  • That worked: $x = Get-PrintJob -PrinterName Zebra1, then Remove-PrintJob $x. Once you said that I realized that the variable is in the right format, to replace the whole rest of the Remove-PrintJob cmdlet. Thank you. Now I just have to figure out how to send ~JA to the printer. Commented Dec 16, 2020 at 14:13
  • I feel like for sending ASCII text to the printer, you will need to install a driver that supports straight passthru. Then send the characters. Commented Dec 16, 2020 at 14:15
  • AdminOfThings you are correct. The ZDesigner printer driver does have the option to do this. It does, of course, not work! But I added a driver for gen text, and put it on the same USB port. Yes, this creates a mess. Some times it works, some times it starts generating a label. So far I've figured out that I'll need to reset the spooler before sending a command. Found this out because Zebra Setup Utilities is unable to communicate via this USB port after deleting the print. The adventure continues.. Oh did I mention that the script needs to run as Admin to restart the spooler?? :) Commented Dec 17, 2020 at 15:17

1 Answer 1

1

Putting my comment into an answer so it can be accepted and closed out $x = Get-PrintJob -PrinterName Zebra1, then Remove-PrintJob $x

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.