Page 1 of 1 1
Topic Options
#88420 - 2002-10-04 04:01 PM detecting "Printer Busy or Error"
BrianTX Offline
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 Offline
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 ]
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#88422 - 2002-10-04 04:38 PM Re: detecting "Printer Busy or Error"
BrianTX Offline
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
#88423 - 2002-10-04 04:40 PM Re: detecting "Printer Busy or Error"
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11162
Loc: Boston, MA, USA
Then it's about time. WMI makes remote management/monitoring a lot easier and there are already a couple of scripts posted that deploy WMI on Windows 9x/NT.
_________________________
There are two types of vessels, submarines and targets.

Top
#88424 - 2002-10-04 04:44 PM Re: detecting "Printer Busy or Error"
BrianTX Offline
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 Offline
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.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#88426 - 2002-10-04 04:54 PM Re: detecting "Printer Busy or Error"
BrianTX Offline
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
#88427 - 2002-10-04 04:59 PM Re: detecting "Printer Busy or Error"
BrianTX Offline
Korg Regular

Registered: 2002-04-01
Posts: 895
Ok.. i found it.. had to dig, though... Microsoft is trying hard not to support NT 4 anymore..

http://www.microsoft.com/downloads/release.asp?ReleaseID=18490

Brian

Top
#88428 - 2002-10-04 05:02 PM Re: detecting "Printer Busy or Error"
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Well... if it's NT4 you need to reboot once a week anyway so just schedule the WMI install to coincide.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#88429 - 2002-10-04 05:05 PM Re: detecting "Printer Busy or Error"
BrianTX Offline
Korg Regular

Registered: 2002-04-01
Posts: 895
We do fine with once a month reboots... print servers almost never have issues.

Brian

Top
#88430 - 2002-10-04 05:24 PM Re: detecting "Printer Busy or Error"
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Talk about lazy admin-itis...

I just bring up the detail view of the "Printers" share on my Win2K print server and the status, # of docs, etc. is right there with my choice of sort order.

Then there's the users... they call the HelpDesk after they tried ten times to print...
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#88431 - 2002-10-04 06:07 PM Re: detecting "Printer Busy or Error"
BrianTX Offline
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 Offline
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
#88433 - 2002-10-04 07:19 PM Re: detecting "Printer Busy or Error"
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Wonder if I'm adding complexity where none is needed...

Wouldn't you need to have some sort of timing loop to allow for "Normal" occurrences of these conditions?

I haven't tested the code but would not want to be too quick to delete all jobs from the Q.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#88434 - 2002-10-04 07:49 PM Re: detecting "Printer Busy or Error"
Radimus Moderator Offline
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.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#88435 - 2002-10-04 07:49 PM Re: detecting "Printer Busy or Error"
BrianTX Offline
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
#88436 - 2002-10-04 08:11 PM Re: detecting "Printer Busy or Error"
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
What about using WIN32_Printer instead of WIN32_PrintJob?

"Select * from Win32_Printer Where PrinterStatus = '1' or PrinterStatus = '2'"

Top
#88437 - 2002-10-04 08:47 PM Re: detecting "Printer Busy or Error"
BrianTX Offline
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
#88438 - 2002-10-10 09:29 AM Re: detecting "Printer Busy or Error"
Wizard Offline
Hey THIS is FUN
*****

Registered: 2000-12-05
Posts: 264
Loc: Bristol, England
OT:

LLigetfa and BrianTX,

We have over 20 NT4 servers here and the last reboot was a power failure with the UPS about 6 months ago.!

I can't belive that you need to reboot your servers so regularly.!

W
_________________________
Wizard
There's no place like 127.0.0.1

vb | kix | batch | html | cfm | js | english

Top
#88439 - 2002-10-10 09:48 AM Re: detecting "Printer Busy or Error"
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22298
Loc: OK
wiz, it depends a lot of hardware.
my nt-network pdc is compaq and it's uptime is also several months and normal boot reason is too long power outage or system hardware upgrade.

then, our old mailserver is also compaq and it reboots itself with crash 1-10 days from last crash. [Big Grin]

but, good old nt server is good slave and with good care it's uptime truly can be 6 months.
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 37 anonymous users online.
Newest Members
FlyHorton, mschwj, Barchester, Evgeniy, kvanacker
17498 Registered Users

Generated in 0.04 seconds in which 0.01 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org