{"id":623,"date":"2015-05-05T06:46:18","date_gmt":"2015-05-05T04:46:18","guid":{"rendered":"https:\/\/www.em-soft.si\/myblog\/elvis\/?p=623"},"modified":"2015-05-08T08:36:32","modified_gmt":"2015-05-08T06:36:32","slug":"deleting-print-jobs-in-error-on-print-server","status":"publish","type":"post","link":"https:\/\/em-soft.si\/myblog\/elvis\/?p=623","title":{"rendered":"Deleting print jobs in Error on print server"},"content":{"rendered":"<p><span style=\"font-family: times new roman,times,serif; font-size: 12pt;\">I had a problem in an environment where all users print thru one print server. The printer was worst one and we always had problems to delete some jobs in error. The users were also unable to print when the printer had a job in error. So, we wanted to automate that procedure to keep printers alive as much as possible.<\/span><br \/>\n<span style=\"font-family: times new roman,times,serif; font-size: 12pt;\"> In this case, we found two different but similar solutions, both in PowerShell. <\/span><br \/>\n<span style=\"font-family: times new roman,times,serif; font-size: 12pt;\"> The first is to delete jobs in non-working hours (true the night). We used the script: <\/span><\/p>\n<p><span style=\"font-size: 12pt;\"><strong><span style=\"font-family: times new roman,times,serif;\"><span style=\"font-family: courier new,courier,monospace;\">get-printer | where {$_.PrinterStatus -ne &#8220;Normal&#8221;} | get-printjob |Remove-PrintJob<\/span> <\/span><\/strong><\/span><\/p>\n<p><span style=\"font-family: times new roman,times,serif; font-size: 12pt;\">This script deletes all jobs on all printers where the status of the printer is not normal. This are pros and contras:<\/span><\/p>\n<ul>\n<li><span style=\"font-family: times new roman,times,serif; font-size: 12pt;\">It runs thru the night, so the printer could be offline for whole day,<\/span><\/li>\n<li><span style=\"font-family: times new roman,times,serif; font-size: 12pt;\">All jobs on the printer are lost. We preferred to do it in this way, as we didn\u2019t know what kind of jobs were in the queue. It could a confidential information and is better to lose the job as leave those papers in the printer,<\/span><\/li>\n<li><span style=\"font-family: times new roman,times,serif; font-size: 12pt;\">It has minimum impact to the print server.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-family: times new roman,times,serif; font-size: 12pt;\">The second option is running a similar script every few minutes: <\/span><\/p>\n<p><span style=\"font-family: courier new,courier,monospace; font-size: 12pt;\"><strong>get-printer | Get-PrintJob | where {$_.JobStatus -match &#8220;Error&#8221;} | Remove-PrintJob<\/strong><\/span><\/p>\n<p><span style=\"font-family: times new roman,times,serif; font-size: 12pt;\">This script has those pros and contras:<\/span><\/p>\n<ul>\n<li><span style=\"font-family: times new roman,times,serif; font-size: 12pt;\">It could be run every few minutes and printers are really many time online,<\/span><\/li>\n<li><span style=\"font-family: times new roman,times,serif; font-size: 12pt;\">It has more impact on the print server as the previous, but the impact is still minimum. There is not real difference in server usage.<\/span><\/li>\n<\/ul>\n<p><span style=\"font-family: times new roman,times,serif; font-size: 12pt;\">After consulting with the customer, the best choice was the second version, running every 5 minutes. Now we have printers really with better uptime and the server is running practically on the same performance. Be careful that you run this script with an account who has permissions to delete print jobs (Print Administrator) and it will work. Anyway, if it is possible is always better to find the cause of errors and repair it. It is not always possible, but try to do it, before you use the script.<\/span><br \/>\n<span style=\"font-family: times new roman,times,serif; font-size: 12pt;\"> Still I am convinced that the best way to solve this type of issues is assign the second option directly to an error. When the printer is going to error, it is acknowledged as <strong>Error 372; Source: PrintService<\/strong>. You have just to assign a task to this error.<\/span><a style=\"text-decoration:none\" href=\"\/index.php?s=buy-viagra-oral-jelly-legally-online\">.<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had a problem in an environment where all users print thru one print server. The printer was worst one and we always had problems to delete some jobs in error. The users were also unable to print when the printer had a job in error. So, we wanted to automate that procedure to keep [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32,11,13,15],"tags":[17,41,25,39,40],"class_list":["post-623","post","type-post","status-publish","format-standard","hentry","category-powershell","category-terminal-server","category-windows","category-windows-server","tag-essentials-server-2","tag-powershell","tag-terminal-services","tag-windows","tag-windows-server"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/em-soft.si\/myblog\/elvis\/index.php?rest_route=\/wp\/v2\/posts\/623","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/em-soft.si\/myblog\/elvis\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/em-soft.si\/myblog\/elvis\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/em-soft.si\/myblog\/elvis\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/em-soft.si\/myblog\/elvis\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=623"}],"version-history":[{"count":2,"href":"https:\/\/em-soft.si\/myblog\/elvis\/index.php?rest_route=\/wp\/v2\/posts\/623\/revisions"}],"predecessor-version":[{"id":625,"href":"https:\/\/em-soft.si\/myblog\/elvis\/index.php?rest_route=\/wp\/v2\/posts\/623\/revisions\/625"}],"wp:attachment":[{"href":"https:\/\/em-soft.si\/myblog\/elvis\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=623"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/em-soft.si\/myblog\/elvis\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=623"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/em-soft.si\/myblog\/elvis\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=623"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}