Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Email alert that spooler has stopped

Status
Not open for further replies.

timbath

IS-IT--Management
Mar 8, 2003
79
GB
I have two terminal servers running Windows 2000 Advanced Server, one in application mode and the other in admin mode. Recently the print spooler has started to stop unexpectedly, more often on the application server (this serves 25+ users). Rather than wait for my users to complain that there are no printers available to them and then restart the spooler manually can anyone help me with a way I could get an e-mail alert that the service had stopped or, even better, get it to restart automatically?

Any help would be very much appreciated.

Thanks
 
im sure you can write a script or batch file to check the status and try restart
 
in the properties of the print spooler services, does it have options you can set upon failure to restart and then 3rd try can run a script.

_______________________________________
Great knowledge can be obtained by mastering the Google algorithm.
 
Thanks TechyMcSe2K. Have set to restart service three times. That should sort it as I use shutdown to restart every night.
 
Open the performance monitor and create some alerts on performance object "print queue". Then you can set the action to run a script that sends emails, send a network message, as well as log it into the event log.

Start, Help. You'll be surprised what's there. A+/MCP/MCSE/MCDBA
 
Is the spooler actually stopping? Or is it hanging?

I have seen this many times before and it is usually due to a bad print driver. The problem though is that the spooler usually hangs and does not actually shut down.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Thanks markdmac

I think it may just be stopping as there is nothing in the event log.
 
An alternative that carries a little risk is to give the TS users a web page that allows them to restart the Spooler service if it is hung. Then problem here is that it can result in data loss. People with print jobs that were stuck will need to resend.

Code:
<%@ Language=VBScript %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<%
'==========================================================================
'
' NAME: RestartSpooler.asp
'
' AUTHOR: Mark D. MacLachlan , The Spider's Parlor
' URL   : [URL unfurl="true"]http://www.thespidersparlor.com[/URL]    
' COPYRIGHT (C) 2009 All rights reserved
' DATE  : 11/24/2006
'
' COMMENT: Restarts the spooler service
'
'
'    THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
'    ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
'    THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
'    PARTICULAR PURPOSE.
'
'    IN NO EVENT SHALL THE SPIDER'S PARLOR AND/OR ITS RESPECTIVE SUPPLIERS 
'    BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
'    DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
'    WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
'    ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
'    OF THIS CODE OR INFORMATION.
'==========================================================================
Sub Window_Onload
	TableArea.InnerHTML = GetServices	
End Sub
Function GetServices
	Dim objWMIService, objItem, objService, strServiceList
	Dim colListOfServices, strComputer, strService, ServiceArea
	strComputer = "."
	Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
	Set colListOfServices = objWMIService.ExecQuery("Select * from Win32_Service Where Name='spooler'")
	For Each objService in colListOfServices
	    startButton = "<input class='button' type='button' value='Start' name='start_button' onClick='ModifyService " & Chr(34)& objService.name & Chr(34)&","& Chr(34)& "start" & Chr(34)&"'>"
	    stopButton = "<input class='button' type='button' value='Stop' name='stop_button' onClick='ModifyService " & Chr(34) &  objService.name & Chr(34)&","& Chr(34)& "stop" & Chr(34)&"'>"
		ServiceArea = ServiceArea & "<tr><td>" & objService.name & "</td><td>"& objService.state &"</td><td>"& stopButton & "</td><td>"& startButton & "</td></tr>"
	Next
	GetServices = "<table border =1 bgcolor=white><th>Service Name</th><th>Service State</th><th colspan=2>Action</th>"& ServiceArea & "</table>"
End Function
Function ModifyService(strService, action)
	Dim objService
	strComputer = "."
	Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
	Set colServices = objWMIService.ExecQuery ("Select * from Win32_Service Where Name ='"& strService & "'")
	For Each objService in colServices
		If action = "start" Then
			objService.StartService()
		Else
			objService.StopService()
		End If
	Next 
	Location.Reload(True)
End Function

%>

<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Enumerating Services</title>
</head>

<body><h1>
<strong>Spooler Management</strong></h1>
<span id=TableArea>Connecting To Services, Please Wait</span>
</body>

</html>

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Seems the spooler is hanging, not stopping. When looking at printers they have all disappeared. Then looking at services the spooler appears to be started, can be stopped but then not started again. Reboot sorts it.
 
I used to see that on Windows 2000 often. Has been fixed in 2003. You should budget for an upgrade to 2003 before you can't buy 2003 anymore. Also consider that there is no longer support for 2000 so you are not getting security updates like you should.

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top