The script is available for download from https://gallery.technet.microsoft.com//How-to-cancel-and-clear-d6cc147d. You can also use Microsoft Script Browser for Windows PowerShell ISE to download the sample with one button click from within your scripting environment.
This VBScript shows how to cancel print jobs stuck in the print queue.
Maybe you have ever run into the situation where you try to print something and nothing happens. There are a ton of reasons why a print job may not actually print, but one of the common causes is that the printer queue has a stuck print job. Sometimes you can manually go in and delete the print job, but sometimes you just can’t get rid of it. This script sample will show you how to clean up the legacy print jobs.
You can find more All-In-One Script Framework script samples at https://aka.ms/onescriptingallery