#88420 - 2002-10-04 04:01 PM
detecting "Printer Busy or Error"
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
We have multiple LPR queues on multiple NT 4 servers. Occasionally, I get requests to purge the print jobs from the queue. It would be nice to have a script running that checks for stuck print queues via ADSI about once every 15 minutes. Unfortunately, I am unsure how to pull the data "Printer busy or error" that is on the print job when it is "stuck" in the queue. I tried checking the status of the print job with ADSI, but I get back "16" which translates to "Printing". I have been unable to retreive the information "Printing - Printer Busy or Error"..
I suppose I have lazy admin-itis. I would just like to have "stuck" queues automatically cleared, and be emailed if the ip for the LPR printer cannot be pinged. Any ideas?
Brian
|
Top
|
|
|
|
#88421 - 2002-10-04 04:13 PM
Re: detecting "Printer Busy or Error"
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
get kixomatic, and check out win32_printJob
you will probably have to write a script that checks all your connected printers (you will have to connect to all printers you want to monitor)
then use AT or Soon to schedule the script to run and then reschedule itself [ 04. October 2002, 16:13: Message edited by: Radimus ]
|
Top
|
|
|
|
#88422 - 2002-10-04 04:38 PM
Re: detecting "Printer Busy or Error"
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
Hmm. Well, the JobStatus works on my local PC... the only problem is that I don't have WMI installed on my Windows NT 4.0 print servers at this point.
Brian
|
Top
|
|
|
|
#88424 - 2002-10-04 04:44 PM
Re: detecting "Printer Busy or Error"
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
I don't need a script to deploy WMI... I just need to install without reboot.. can't have servers down with 60 print queues on each.
Brian
|
Top
|
|
|
|
#88425 - 2002-10-04 04:47 PM
Re: detecting "Printer Busy or Error"
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
I don't think you really need it on the servers, if you can see the status on your machine, and you have permissions to do so, your PC can kill the job.
|
Top
|
|
|
|
#88426 - 2002-10-04 04:54 PM
Re: detecting "Printer Busy or Error"
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
I can't see it on my PC unless I map to every printer (over 300) which I'm not going to do. Also, Microsoft sure makes it hard to find WMI for NT on their site.. I suppose I could use the version intended to be installed with SMS on their ftp site.
Brian
|
Top
|
|
|
|
#88429 - 2002-10-04 05:05 PM
Re: detecting "Printer Busy or Error"
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
We do fine with once a month reboots... print servers almost never have issues.
Brian
|
Top
|
|
|
|
#88431 - 2002-10-04 06:07 PM
Re: detecting "Printer Busy or Error"
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
Yep.. that's what I've been doing.. I'd rather just automagically catch these jobs that won't print.
Brian
|
Top
|
|
|
|
#88432 - 2002-10-04 06:42 PM
Re: detecting "Printer Busy or Error"
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
Okay.. I came up with a convoluted script that seems to work.. lol.. I may have to redo this to make it simpler.
code:
break on $cpname="servername" $objcomp=GetObject("winmgmts:{impersonationLevel=impersonate}!\\$cpname") $objjob=$objcomp.EXecQuery("Select * From Win32_PrintJob Where JobStatus='Printer Busy or Error'")
For each $job in $objjob $printername=SPLIT($job.name,",",1)[0] $sharename=$objcomp.Get("Win32_Printer='$printername'").sharename $sharename ?
$objpq=GetObject("WinNT://$cpname/$sharename") $objpq.Purge @error If @error = 0 ? "All jobs cancelled for " + $printername + "." Else ? "Purge failed for " + $printername + "." Endif Next
Brian
|
Top
|
|
|
|
#88434 - 2002-10-04 07:49 PM
Re: detecting "Printer Busy or Error"
|
Radimus
Moderator
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
well, I'd use SOON.EXE from the reskit and have it schedule itself to run every 15 or 20 minutes.
|
Top
|
|
|
|
#88435 - 2002-10-04 07:49 PM
Re: detecting "Printer Busy or Error"
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
I'm only deleting jobs that are filtered with:
"Printing - Printer Busy or Error"
But, yes.. I have thought of that.. I'm actually thinking of listing the particular job, when it was created, etc, then asking the user whether or not to purge the queue. ADSI is much better for this, but WMI is more feature rich, so after I find out which job gets the error from WMI, I can pass everything to ADSI for simplicity. (I haven't gotten that far, yet, though)
Brian
|
Top
|
|
|
|
#88437 - 2002-10-04 08:47 PM
Re: detecting "Printer Busy or Error"
|
BrianTX
Korg Regular
Registered: 2002-04-01
Posts: 895
|
Hmm.. yeah.. I've thought of doing something like that.. but the JobStatus gives me the information I want.. the other data is not always applicable.
Essentially, my end goal is to be able to monitor multiple print servers from a single console. This should be doable with WMI and/or ADSI.
Brian
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 515 anonymous users online.
|
|
|